I'm trying to make an HTTP server on golang that accepts long-polling
connections. It accepts connections and when it receives an USR1 signal,
it responds to all clients.
The code is on https://gist.github.com/1039785
My problem is that it can't accept more than 282 clients simultaneously.
I think the cause is the VIRT memory: it takes 3G and I'm on a 32-bits
system.
Is there an obvious error on my code? An environment variable that I
should set?
++
Bruno
I don't know what issues you're running into. I copied your code,
stubbed out the signal handler, and then ran it on Windows (8g). I then
wrote a trivial python script that connects to the port and issues a simple:
GET / HTTP/1.0
Host: localhost
And I'm able to get 500 connections without any problem. (I certainly
don't see the VIRT memory consumption that you're seeing.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4BzoEACgkQJdeBCYSNAAMWkwCdEMDpxOvVdR0jnooTsZEejW2J
gnEAoJH5ZiGi9YOYp50R2w6y56k2MboP
=0YFV
-----END PGP SIGNATURE-----
Thanks for the tip. I can now keeps 10,000 connexions simultaneously
without problems.
++
Bruno
Confirmed!!! Go can solve the 10K problem!!!
:-D
--
André Moraes
http://andredevchannel.blogspot.com/
I wanted to stress my server now that it can handle thousands of
connections, and I wrote a client in Go for that. But I have the same
problem: 3G of VIRT memory because of OS threads (one per connection).
The (simplified) code is on https://gist.github.com/1048668. Is there a
way to make an HTTP connection without using its own thread (or even a
TCP one)?
++
Bruno
> conn.Do(&req)
on line 25
O should close the response.
The go issue tracker gives me an error 500 at the moment so I can't
create an issue, but the attached code will trigger what I'm
describing against a local http server (copy/pasted from the
http.ListenAndServe documentation).
andrey
++
Bruno