News for hackers. Stuff that matters.
Re:Web Applications Should Be Compiled by tptacek on Tuesday June 02, 2009 @07:14PM (#638856)
Did you just write that most web-apps aren't I/O bound? Because that sounds completely backwards.
Re:Web Applications Should Be Compiled by timr on Tuesday June 02, 2009 @07:17PM (#638861)
No. Obviously, any individual request/response is I/O bound. But the server doesn't have to be I/O bound.
Re:Web Applications Should Be Compiled by tptacek on Tuesday June 02, 2009 @07:28PM (#638880)
The top line in a gprof profile of an evented C web server had better be select() (or equivalent) or read() (or equivalent). So I don't follow you here.
Re:Web Applications Should Be Compiled by timr on Tuesday June 02, 2009 @09:17PM (#639001)
Yes, the average server thread is going to spend far more time blocked on I/O than not. But the server should be able to handle more than one request simultaneously.

(Or you can use an event model; the point is, if your server is spending all of its CPU time blocked while under load, then something is wrong.)

Re:Web Applications Should Be Compiled by tptacek on Tuesday June 02, 2009 @09:51PM (#639043)
Now you're not following me, timr. An evented server can handle 10,000 connections simultaneously. Run it under load, profile it. Select is at the top of the profile. The program spends all its time in the kernel, waiting on I/O.

That evented server is also faster than the threaded version of same.

What's the compute task you think a program is bottlenecking on in an application that does nothing but shovel data out of a database into a socket based on a btree key?

Re:Web Applications Should Be Compiled by timr on Wednesday June 03, 2009 @02:23PM (#640149)
You're overgeneralizing. Where your server spends its time depends entirely on the profile of your app. If your pages render (on average) in less time than they wait for I/O, then your server will spend most of its time blocked on I/O.

I suspect that you're thinking of something like a lightweight proxy server, that waits for incoming requests, then quickly hands them off to an app server that does most of the work. That's trivial. If you just profile just the webserver process, then yes, you would expect that most of its time would be spent in wait. But while the proxy server is blocked on I/O, the app server is doing a ton of other things for any non-trivial page rendering.