2 ms·
Often a database is used to do simple message passing - campfire, twitter, pretty sure they both use a db to pass messages around. >> "You should not use flat
by axod 18y ago
Often a database is used to do simple message passing - campfire, twitter, pretty sure they both use a db to pass messages around.
>> "You should not use flat files for web apps - they don't handle concurrency very well."
That's a silly blanket statement. If I have a single thread that deals with something, of course it can use a flat file to store it. The problem is, that some people decide to use webservers that cause concurrency issues by having multiple threads doing similar things for different users.
It sounds like you're still thinking about standard accepted many threads, database, etc etc.
- ars 18y agoUh what? If you have just a single thread of course you don't have to worry about concurrency. Isn't that what I just said? And you are seriously making a webserver that serves just one request at a time? There is a good reason it's "standard accepted" to use many threads, and a database. I guess you could have just one thread, with a queue, and do just one thing at a time without a database. Don't know why you would want that though.
- axod 18y agoMy webserver is currently serving 5k clients in a single thread... If you follow "standard accepted", you won't get anywhere.
- ars 18y agoUm, everyone's webserver can handle 5k requests (per day) in a single thread. Not sure how many requests your clients do per day since you didn't say. Can you handle 1 million requests (per day) on a single thread? By using just one thread you are serializing your bottlenecks (CPU, IO, network). If you have more than one, one can be waiting for IO, while the other uses CPU. Plus CPU speeds are not getting faster, the future is multi core.
- abstractbill 18y agoUm, everyone's webserver can handle 5k requests (per day) He's not talking about the number of requests per day, he's talking about the number of simultaneous requests.
- ars 18y agoMaybe I'm not understanding something - how do you do simultaneous requests in a single thread? And I knew he couldn't possibly mean 5K per day, but he didn't say how many it was.
- axod 18y agoThe internet has made me sad. :( http://en.wikipedia.org/wiki/Asynchronous_I/O http://en.wikipedia.org/wiki/Asynchronous_I/O
- abstractbill 18y agoBe happy, there was a time when we didn't know about this stuff either ;-)
- axod 18y agoAh the days of threadpools, the cpu battling to context switch. The late nights battling to hold the cpu steady and add just another few threads, good times, good times :) You are of course right though. Easy to forget...
- abstractbill 18y agoMaybe I'm not understanding something - how do you do simultaneous requests in a single thread? http://www.kegel.com/c10k.html http://www.kegel.com/c10k.html I'm not too shocked you don't know about it, to be honest - not enough people do for some reason. Axod and I are lucky to have worked together on a very large-scale problem at a previous company that could never have been handled with a threaded approach. I've since moved on to Justin.TV, where I wrote a single-threaded chat server that scales to over 10k connections per server cpu (we run it on many 8-cpu boxes). Axod is now the founder of mibbit, and he's obviously using a single-threaded approach there too.