Earlier quoted context omitted.
On the frontend I was already using lighttpd, but I could have used memcached on the backend that was going to be the next step if the c app didn't work. It just worked so well I didn't have to worry about it.
I didn't mean to poop on your parade. I love writing servers too but if you have a public facing HTTP server there are a ton of obscure edge cases to worry, like some script kiddy DOSing your server by either opening a connection and keeping it open without sending anything or dribbling out a character a minute to circumvent your SIGALRM handler. I'd think about switching back to a public interface that has been thro…
Moving from PHP to C saved my web startup.
41–50 of 85 posts
Re: Moving from PHP to C saved my web startup.
#42Re: Moving from PHP to C saved my web startup.
#43it doesn't make sense to make a new connection every 1 second, esp. to apache. that is where your prob was, not php
Re: Moving from PHP to C saved my web startup.
#44have you considered using rabbitmq/0mq? It sounds like they are perfect candidates for what you are trying to achieve.
Re: Moving from PHP to C saved my web startup.
#45Earlier quoted context omitted.
I'm not trying to be offensive either :) I was just warning that putting up a public facing server is eventually going to make you a target. Using a battle tested server will let you concentrate on getting more people to use your app instead of fighting bored 13 year olds trying to bring your server down. Good luck with your app!
Thanks! I understand your point, but a fork server is so simple I don't think there is much that can go wrong there, if it was serving more data I would be worried, but its meant to do a quick and short reply.
Re: Moving from PHP to C saved my web startup.
#46So it really wasn't PHP but Apache right? In an hour you could have switched out your front end server to Nginx and had it serve responses from Memcached and then keep the Apache/PHP backend and change it to update Memcached on bid changes. Here are some links: http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-b... http://lserinol.blogspot.com/2009/03/speeding-up-your-nginx-...
Re: Moving from PHP to C saved my web startup.
#47Polling in real time always needs to be done in some compiled language. The good folks at 37 Signals ran into this when they launched their CampFire app. For instance, consider what David Heinemeier Hansson says about Campfire, the chat software he helped developed. First written in Ruby On Rails, it soon became clear that the code that polls to see who is in the chat room needed to be as fast as possible: "We rewrot…
Re: Moving from PHP to C saved my web startup.
#48Earlier quoted context omitted.
Thanks! I understand your point, but a fork server is so simple I don't think there is much that can go wrong there, if it was serving more data I would be worried, but its meant to do a quick and short reply.
it's not called a forkbomb for nothing
Fork Bombs are easier to pull off from the command line. Not so much with DOS. I would say that loading a large webserver for each request would use up more resources than a tiny C program. Thats the whole point of the post.
Re: Moving from PHP to C saved my web startup.
#49Polling in real time always needs to be done in some compiled language. The good folks at 37 Signals ran into this when they launched their CampFire app. For instance, consider what David Heinemeier Hansson says about Campfire, the chat software he helped developed. First written in Ruby On Rails, it soon became clear that the code that polls to see who is in the chat room needed to be as fast as possible: "We rewrot…
...which [Erlang] is not compiled.
Running Erlang has some overhead, sure, but that's because it's designed for distributed systems where you can pull a plug out of the wall without interrupting service. I wouldn't use Erlang for number crunching, but using it as a glue language for a networked system hits all its strong points.
Re: Moving from PHP to C saved my web startup.
#50have you considered using rabbitmq/0mq? It sounds like they are perfect candidates for what you are trying to achieve.
I had never heard of those before. Are they capable of working inside any web broswer? Looking it up right now.
If you have 100 users, each one waiting for a message in their queue, then you can "broadcast" a single message to all of the queues (or a group) with one command. All the users waiting for a message in their queue will get a copy.
Another approach which is hack-ish imo, is to use something like jabberd to broadcast messages.