
SyncPad Node.js Server Revisited - roder
http://blog.mysyncpad.com/post/2143658273/syncpad-node-js-server-revisited
======
gcr
I have this problem too -- with my project, the server right at once uses 100%
CPU and memory increases dramatically. During this time, it stops responding
to requests. Monit notices this and just restarts it. This happens for me
roughly every half-an-hour under very high load.

I'm using JSON parsing but not much else. No dependencies / libraries at all.
Are there any steps I can take to provide useful data? Would anyone like me to
run it with --prof and hammer it with 'ab' for example?

Here's the code: <http://github.com/gcr/goggles>

------
mishmash
So the results were worse, even though everyone involved thought they would be
better on the updated version.

Any theories?

~~~
roder
I have no idea, I am completely baffled. I really want to try without the
node_redis library and do it all in memory, keeping the Array of elements in
the returned list at less than 1000.

UPDATE: I should also mention, if you look at the charts, there's a point in
time which the CPU hits 99%-100% and it's always reproducible. Once the CPU
hits 100% I have just sat back and watched the memory get chewed up.

I'm sure someone w/ more experience than me can probably debug what's going
on. The code is there, I really hope someone else can take a look at it. As my
friend mentioned, it's reproducible, it can be fixed.

~~~
mishmash
Don't know if you'll see this, but as someone playing with both node and
erlang, I'd love to hear more about your erlang setup (and your blog was down
earlier when I looked).

~~~
roder
tumblr :/

The way that SyncPad was prototyped was using PHP/MySQL. I ported that to
using Mochiweb. I manage all of the queuing of messages through a relatively
straight forward OTP gen_server and Redis.

------
davidw
Erlang has various defects, but it is bomb proof in many ways - it's been out
there for many years with many people using it for critical infrastructure.

I'd bet on Node.js and similar efforts for the future, but Erlang is a pretty
nice system and well worth looking at and learning from.

------
geuis
@roder, can you include the ./config file in your github repo for
toyserver.js? Trying to replicate your setup and this is missing.

~~~
roder
gist was updated, I included a client, which is needed to recreate the issue.

~~~
tlrobinson
I think this is the first time I've actually updated a gist I cloned. It all
makes sense now.

However, I can't figure out how to run this. I have your toyserver.js (and
redis) running, and I have client.html making requests to the server, but the
server always returns an empty response. My redis db is empty, is there
something I need to do to populate it?

~~~
roder
here ya go: <https://twitter.com/#!/roder/status/12954711699230720>

~~~
tlrobinson
Thanks, can't seem to reproduce it though. I'm running Node from ry/node
master (v0.3.2-pre) on OS X.

