From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: What exactly is the licensing situation with GNAT? Date: Tue, 18 Nov 2014 16:25:03 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <084b1934-9641-425e-85ec-293e0334413e@googlegroups.com> <86bf69c8-eb08-4696-b6c9-3784f5c42213@googlegroups.com> <87389olqie.fsf@ixod.org> <19fa65d4-72c9-44ab-b44b-4ea0929c18f2@googlegroups.com> <25731193-c0b5-4ab7-87ff-ba8c6a42cdbd@googlegroups.com> <1se4bvo6gaqft.16cfjaiketlz0$.dlg@40tude.net> <13efsbp4ynti1.1qsb6buqa4a60.dlg@40tude.net> NNTP-Posting-Host: 24-196-82-226.static.mdsn.wi.charter.com X-Trace: loke.gir.dk 1416349505 14144 24.196.82.226 (18 Nov 2014 22:25:05 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 18 Nov 2014 22:25:05 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:23528 Date: 2014-11-18T16:25:03-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:13efsbp4ynti1.1qsb6buqa4a60.dlg@40tude.net... > On Mon, 17 Nov 2014 18:28:42 -0600, Randy Brukardt wrote: ... >> Since Janus/Ada only uses one thread per Ada program, >> no server would work at all if everything was blocking. I know the server >> type works well distributing accesses to different Ada tasks (even on >> Janus/Ada, where everything is done by one thread). >> >> OTOH, we implemented non-blocking sockets for outbound traffic in Claw >> sockets as well. I implemented a version of the web server using those >> sockets, and it turned out the performance (at least on Windows 2K/XP) >> was >> something like 10 times slower using non-blocking sockets compared to >> busy-waiting the blocking sockets. > > Depends on how you measured it. Latencies may increase for obvious reason > of context switching. The rest should have no influence. I probably mispoke; I think I was mainly concerned about server load than raw performance (the public Internet, after all, is relatively slow compared to a computer). And it made the web server use 10 times the CPU (or something in that range) compared to "smart" busy-waiting using blocking sockets. The resulting server load made the server unusable (it would have taken 100-150% of the available CPU to provide decent performance). > Apparently, Windows launches threads for >> the non-blocking socket operations, which is SLOW. > > No, that cannot be. We are using non-blocking sockets massively e.g. tens > of thousands, needed to fiddle system settings to allow so many. It > certainly does not start threads because Windows cannot have so many. Possibly. Or perhaps its changed in more recent Windows versions. Something was taking a whole lot of CPU in the OS (not in our code, based on profiling). >> I made the busy-waiting >> much smarter in the web server (using a increasing wait for each >> iteration) >> and got much better overall performance than either alternative. No, everything I did was in Ada; I didn't try to stress Winsock any more than I had to (it's quite fragile in W2K and crashes the computer regularly). "Smart" busy-waiting just means to wait amounts of time based on likely response times (they're not linear!). Either data becomes ready very soon (within an ms or so), or it probably needs to wait for additional packets, so a longer wait is needed. In the later case, we use delay so that other tasks can run (as noted, in Janus/Ada without that the program would effectively be blocked). Of course, the sorts of things I did might not work as well on GNAT (which does use threads), there might be a lot of context switching overhead. I expect to be trying that sometime this winter once I get further along in the porting project. Randy.