Earlier quoted context omitted.
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
I don't normally care about downvotes, but if I give out a nice explanation and you don't like it, it'd be nice to get a reply. Was my response wrong? How? I might learn something from your response.
Why events are a bad idea for high-concurrency servers (2003) [pdf]
21–30 of 50 posts
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#22Worth noting this is from 2003. The performance concerns of event-based servers have been greatly alleviated by both hardware and software advancements. The test setup used for this paper was a "2x2000 MHz Xeon SMP with 1 GB of RAM running Linux 2.4.20". Solid PC server iron for 2003, but basically equivalent to a $5/month server from Digital Ocean today. If you're looking to squeeze 100,000 concurrent tasks from tha…
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
On the other hand, simplicity in a code base usually matter. Code written with an evented API, littered of callbacks, is usually harder to read and maintain than that written in a sequential way with a blocking I/O API.
You can recreate a sync API on top of an evented architecture using async/await, but then you have the same performance characteristics of a blocking API, but with all the evented complexity lurking underneath and leaking here and there. Seems to me a very convoluted way to arrive to the point from where we started.
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#23Earlier quoted context omitted.
> The performance concerns of event-based servers have been greatly alleviated by both hardware and software advancements. Threads haven't exactly stood still in that time either, especially if you include green threads, fibers, coroutines, etc. > If you're looking to squeeze 100,000 concurrent tasks from that $5 server, this paper is relevant to you. It's relevant regardless, as part of a long-running back and forth…
I don't think there is back and forth anymore. Actual high performance research (e.g. when the cost of a single mutex is more than the whole CPU budget for processing something, like say a packet) has been devoid of threads since they got into the mainstream, so like for almost two decades already. They are still used, because this is what hardware and OS provide to do something on each core, but not for concurrency…
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#24Earlier quoted context omitted.
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
A context switch in a modern CPU takes only a few microseconds. A GB of RAM costs less than $10. So those concerns, although valid in theory, are usually irrelevant for most web applications. On the other hand, simplicity in a code base usually matter. Code written with an evented API, littered of callbacks, is usually harder to read and maintain than that written in a sequential way with a blocking I/O API. You can…
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#25Earlier quoted context omitted.
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
A context switch in a modern CPU takes only a few microseconds. A GB of RAM costs less than $10. So those concerns, although valid in theory, are usually irrelevant for most web applications. On the other hand, simplicity in a code base usually matter. Code written with an evented API, littered of callbacks, is usually harder to read and maintain than that written in a sequential way with a blocking I/O API. You can…
A GB of ECC server RAM costs more. An extra GB of RAM in the cloud can even cost you $10/mo if you have to switch to a beefier instance type.
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#26Earlier quoted context omitted.
A context switch in a modern CPU takes only a few microseconds. A GB of RAM costs less than $10. So those concerns, although valid in theory, are usually irrelevant for most web applications. On the other hand, simplicity in a code base usually matter. Code written with an evented API, littered of callbacks, is usually harder to read and maintain than that written in a sequential way with a blocking I/O API. You can…
A GB of RAM only costs less than $10 if you are buying for your unpretentious gaming rig. A GB of ECC server RAM costs more. An extra GB of RAM in the cloud can even cost you $10/mo if you have to switch to a beefier instance type.
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#27Worth noting this is from 2003. The performance concerns of event-based servers have been greatly alleviated by both hardware and software advancements. The test setup used for this paper was a "2x2000 MHz Xeon SMP with 1 GB of RAM running Linux 2.4.20". Solid PC server iron for 2003, but basically equivalent to a $5/month server from Digital Ocean today. If you're looking to squeeze 100,000 concurrent tasks from tha…
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
* On Unix, only socket IO is really evented; this can be solved by using a thread pool (the Flash paper describing this problem and solution for httpds dates to 1999[1]) but is inelegant. This is the approach Golang takes behind the scenes.
* How to scale event loop work across cores; this can be solved, but adds complexity. In contrast, threads are quite simple to scale.
* How to share accept() workload across cores; this can be solved, too, but not portably. I.e. your 100 core server may very well be accept-limited if you have a single-core accept loop, or highly contend on a single socket object.
* Threadpools are definitely inappropriate if you have a ton of relatively idle clients (long-poll server, or even typical webserver), but are less wasteful if you have relatively few, always-busy clients.
I don't disagree that the synchronous threadworker design isn't the best choice for high performance services that can afford a lot of engineering time to design and find all the bugs. But thread-per-client is often a completely acceptable place to start.
[1]: https://www.usenix.org/events/usenix99/full_papers/pai/pai.p...
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#28Earlier quoted context omitted.
C10K is another name for evented I/O, and it's from the 90s . By 2003 thread-per-client was already obsolete and known to be very bad. It's really quite simple: threads encourage the use of implicit program state via function calls, with attendant state expansion (stack allocation), whereas evented I/O encourages explicit program state, which means the programmer can make it as small as possible. Smaller server progr…
Evented has some difficulties in practice: * On Unix, only socket IO is really evented; this can be solved by using a thread pool (the Flash paper describing this problem and solution for httpds dates to 1999[1]) but is inelegant. This is the approach Golang takes behind the scenes. * How to scale event loop work across cores; this can be solved, but adds complexity. In contrast, threads are quite simple to scale. *…
Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#29Re: Why events are a bad idea for high-concurrency servers (2003) [pdf]
#30Worth noting this is from 2003. The performance concerns of event-based servers have been greatly alleviated by both hardware and software advancements. The test setup used for this paper was a "2x2000 MHz Xeon SMP with 1 GB of RAM running Linux 2.4.20". Solid PC server iron for 2003, but basically equivalent to a $5/month server from Digital Ocean today. If you're looking to squeeze 100,000 concurrent tasks from tha…
> The performance concerns of event-based servers have been greatly alleviated by both hardware and software advancements. Threads haven't exactly stood still in that time either, especially if you include green threads, fibers, coroutines, etc. > If you're looking to squeeze 100,000 concurrent tasks from that $5 server, this paper is relevant to you. It's relevant regardless, as part of a long-running back and forth…
have greater velocity?