Greetings, I was wondering if someone who has experience with working with scaling problems could give me some insight on an issue.
Long story: A) So- I'm making an iPhone/iPad app, which basically is a spiffy view of json data provided by a server. The app makes modifications to the json, the server stores them in mongodb, etc. Model view in the form of a game. I set one of my goals as to have the server run as cheaply as possible, so that even if the app was not popular, I could keep it up with minimal cost/overhead. B) At first I wrote the server in symfony2. But, I'm weary of php, especially when I read the documentation for the "apns" (apple push notification) plugin, which basically says, "well, I wouldn't use what I wrote if you have a lot of users, but you can if you want." C) So then I said, let's do "grails." Promises to be fast. I like java/groovy whatever. I like that I can refactor java without wondering what I'm breaking. But then the throughput was *very* bad. Let's say, 20 connections per second, in production war mode, to do trivial (but not hello world, json blahblah blah) things. I've done some some work on games. 1 seconds on my modern computer is like a whole day on a computer 10 years ago. It is unacceptable to have only 10-20 pages a second, even if I've messed up the configuration. D) So then, this programmer next to me was talking about nodeJS. About how great it is. So this last friday, I ported the server (which is all of 500 lines or so) from grails to nodeJS. Using all the callback stuff, async.auto, etc etc.. But then I'm getting on 60 connections per second. Apparently Json is actually really slow or something. I did some optimization (one of which is just clipping data, which is unacceptable), and profiled and got it to ~120 a second. (I'm using the most intensive function as a baseline). E) So then, I thought: "this is ridiculous." (And I became compulsive. Which sucks.) And on Saturday and Sunday, I wrote a non blocking web server in c++, modules and everything. (I did rip and clean code from a previously personal project). And I'm getting ~2000 completions a second. So you're reading this and saying, "duh. Custom compiled c++ will of course be faster than javascript running in a generic framework. And you've probably messed up configuration or something somewhere." I know this. I feel like I just lost the weekend to some stupid compulsion. But at the same time, I am truly annoyed at how slow these web servers/frameworks are. ------------------------ ------------------------ ------------------------ So my question is this: How do real scaling companies deal with this problem? Non cacheable non static page server. Does scaling become a business decision? Are things really slow, just because they can be? Why do people think "nodeJS fast" ? Or do real scaling companies have C/C++ services, which accept connections from a front end in nodeJS. (because when nodeJS doesn't actually do anything, it really is only 1/6 slower than pure C/C++ solution, which, I guess, is pretty fast.)? How close is v8 to a theoretical maximum? (theoretical maximum would be, I guess, compiled code is near gcc -O3, and compilation is linear with a small coefficient.) Why aren't web server pages through lvmm? It should be possible to create a fibered (which is really what continuations come down to it seems to me at this moment), lvmm, jitter, any language (which lvmm supports), solution to a web page. ---- So, if anyone has any thoughts, let me know. If I've said anything which may be rude, I am not trying to be. In previous experience, I was never concerned with speed, because I was never before, directly paying for it. I guess I'll run the server on nodeJS, and just load balance it if I ever need to. Although, I would very much rather have a lvmm'd pages plugged into a C/C++ server. ---- Thoughts? I this all academic: if things are popular, you will make money, and scaling will becoming a business issue? -tim -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
