2

I'm trying to test a network service app that allows for a large number of simultaneous socket connections.

I have adjusted /etc/sysctl.conf with the following:

kern.maxfiles=65536
kern.maxfilesperproc=65536
kern.ipc.somaxconn=10000

With this in place, ulimit -n shows I have a 65536 "open file" maximum. Yet my service still gets stuck around the 1000th connection.

Thinking that perhaps it's something specific to the platform (Node), I re-implemented a simplified version of it in Golang, but it exhibits the same problem.

It also happens if I split the "client" side up into several procs that each open a handful of connections. The service always get stuck around the 1000th connection.

lsof -p <pid> shows 1011 IPv6 connections like so:

gochat  25034 username  178u    IPv6 0x11c1273e19ee5c8f       0t0       TCP localhost:http-alt->localhost:50080 (ESTABLISHED)

What is imposing this maximum socket connection limit, and how can I expand it?

1

So it turns out that the Go socketio library has a default max setting of 1000 simultaneous socket connections. Calling server.SetMaxConnection(10000) (in conjunction with an appropriately high ulimit -n, as mentioned in the question) will allow > 1000 simultaneous client connections.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .