Title: A few months ago I took the journey into startup land.  I quit my job and decided to finish the project I had been thinking about finishing for a long time. A penny auction app where users are linked to facebook identities.<p>One major worry right from the start with this project was that it required a real time accurately synchronized countdown across multiple browsers.   I was using ajax to call back to the server for an update every 1 second to accomplish this.  I knew it was going to get interesting if a lot of users joined up because they would all be calling the server once every second.<p>Initially I thought we would run into trouble with bandwidth, but I was wrong.  After 4 days we had about 150 users up and bidding when the server decided to crash (right in the middle of an ipad auction just because my luck is that good).  Being on slicehost they had us upgraded within 20 minutes, but still we were working the server hard.  The timer was skipping, we were getting all kinds of strange errors in the logs and things were looking pretty bad.  It wasn't bandwidth, but memory and processor usage that were the problem.<p>I knew from reading articles on HN regularly that PHP is terrible, but I build the app in PHP anyways along with the 1 second callback.  It was the fastest way to get things up and running for me.<p>That night I had an idea, if I built the 1 second call back portion of the app in C the server wouldn't have to load apache with all its extensions every 1 second.  So I built a very simple fork server to send updates back for the real time update.<p>Result:  Processor 99% idle even during heavy use and memory usage basically stays exactly the same whether or not more people are watching the auctions.<p>We now have a few thousand users and things have not changed at all, still running great.  Of course this system will have its limits but so far we have not even dented it.<p>If you want to see it in action you can go to http://apps.facebook.com/bucktobid<p>Edit:  For those who want a little more detail I have a lighttpd server listening on port 80 that redirects to apache for php calls.  If the call comes in for .btb (a made up extension) lighttpd redirects to the C app which listens on another port locally and serves the needed info to the browser.  The updater is 100% C/C++ not an apache module.
Upvote: