Scaling a spdyproxy Node.js server

149 views
Skip to first unread message

Sai

unread,
May 22, 2014, 11:37:06 AM5/22/14
to nod...@googlegroups.com

Hi,

I have implemented a proxy server based on spdyproxy(https://github.com/igrigorik/node-spdyproxy). I have added cluster on the binary file i.e. bin/spdyproxy (http://pastebin.com/BvtpK6kc).

I have tested this on various machines with node.js v0.11.14-pre (downloaded this for round robin on clustering, as earlier it was not using up all the workers)

1. Digitalocean droplets (dual core)
2. a virtual server (16 cores cpu)
3. a dedicated server (8 cores cpu) 

I'have opened this proxy now only for around 100-200 users anytime users and I want to scale it till upto 1000 or even more users. This I have bundled into chrome as an extension where users enable this and anonymise themselves for privacy reasons. I have talked to the developer of spdyproxy , he said more cpu and more RAM would not help as there are not compute tasks, but I have taken number of more cores just for cluster module to create the worker process.

I have done tcp/ip tuning as well increased here is the sysctl.conf additional tcp settings(http://pastebin.com/x9FnqY4u), files are unlimited, following this suggestion(http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/) The core problem on the dedicated server (which is production), the workers keep dying after every 12-18 hours periods.

I have been looking for what the problem is...!  there is issue on tls on this blog (https://blog.indutny.com/0.benchmarking-tls), is this what causing the problem, or the server.js errors in the code node-spdyproxy or is it that or still node.js not ready for this.

Also what caused the threads(cluster process) die slowly one after the other?

How can I get rid of --debug-port for cluster in this build?

Thank You
Sai

Fedor Indutny

unread,
May 22, 2014, 12:01:19 PM5/22/14
to nod...@googlegroups.com
Hello!

You could try setting `bud` (https://github.com/indutny/bud) in front of your servers, or
using latest development version of node.js (0.11.x). Both have much better performance
than node v0.10

Cheers,
Fedor.


--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a72d6692-5063-457a-bf2f-fc5595c3fd98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sai

unread,
May 23, 2014, 4:26:00 AM5/23/14
to nod...@googlegroups.com, fe...@indutny.com
Thank You Fedor for the quick reply. I'm trying to implement bud.

However, I'm already using 0.11.14 pre version. However it is not upto the mark on a dedicated server with 16 cluster workers (i.e. on an 8 core machine). The workers kind of die after every 12-18 hours using it. Every time Ill have to kill the process and start it again after every 12-18 hrs, when number of workers come down.

I'd like to know, how can I inspect what is causing  this cluster process to die?

Thank You
Sai

Sai

unread,
May 23, 2014, 8:11:11 AM5/23/14
to nod...@googlegroups.com
Hi Fedor,

I have tried bud as well. I don't think it working on this proxy server. Here is my conf.json file http://pastebin.com/N2KTAdMa. It is not doing any connect requests or anything. Just let me know if I'm doing anything wrong?

Here is the log file of both bug and spdyproxy (http://pastebin.com/8MvtEjvR)

Thank You
Sai

On Thursday, May 22, 2014 9:31:19 PM UTC+5:30, Fedor Indutny wrote:

Fedor Indutny

unread,
May 23, 2014, 12:06:50 PM5/23/14
to Sai, nod...@googlegroups.com
Well, I think you could check the logs. Server couldn't just die without saying anything at all.

Fedor Indutny

unread,
May 23, 2014, 12:39:02 PM5/23/14
to nod...@googlegroups.com
Hey!

You need to add `spdy/3.1`, `spdy/3` to the `npn` array.


Sai

unread,
May 24, 2014, 2:25:42 AM5/24/14
to nod...@googlegroups.com, fe...@indutny.com
Thank You Fedor, let me add it and test it.

Sai

unread,
May 24, 2014, 3:35:08 AM5/24/14
to nod...@googlegroups.com, fe...@indutny.com
Hi Fedor,

Tried with the settings that you gave, added in the npn, it gives me error message "server sent empty response". Here is the chrome://net-internals/#events (http://pastebin.com/HchSCAwG), here is the new conf.json(http://pastebin.com/KJZY8yJ2) and PAC script(http://pastebin.com/9mpAzKax), but there was no log requests coming on bud log or spdyproxy log

When I removed http protocol(both http/1.1 and http/1.0), it gave connection refused error and I could see it in the bud log(http://pastebin.com/5PgQwYTD).  

since I'm using domain name to connect, is it right to make SNI enabled or how should I configure my bud.conf?

Thank You
Sai

Fedor Indutny

unread,
May 24, 2014, 12:00:15 PM5/24/14
to Sai, nod...@googlegroups.com
Oh, so the first problem is that the order matters here.

Please put spdy/3.1 as a first protocol, and spdy/3 as a second.

Additional important note that I forgot to tell you about: you'll need to either use SpdyProxy as a node.js module (not a cli tool) and pass `plain: true, ssl: false` options to it, or patch it ( https://github.com/igrigorik/node-spdyproxy/blob/master/bin/spdyproxy#L98 ) and add this options manually.

Cheers,
Fedor.
Reply all
Reply to author
Forward
0 new messages