On 09.08.2015 04:22, golangmike wrote:
> Thank you for the slides Ian.
>
> Let me clarify my questions:
> 1) Will golang have equivalent resource usage as the equivalent program
> written in C/epoll()?
> a) memory
> b) cpu
> c) added delay to communication
> d) maximum number of connections
>
It's hard to compare without knowing how your C/epoll() version does?
For example, I have a simple site behind cloudflare. Some time ago I
rewrote it completely in Go (instead of PHP). Cloudflare keeps
connections to the server open now, since Go supports keepalive by
default, so these days the app has anywhere between 20k and 30k open
connections (see the attached picture). Every connection is a goroutine,
and each one uses about 19KB of memory. The whole app uses 0.1% of CPU
to serve about 15k requests per day. That is of course the remaining
traffic after cloudflare cache.
> 2) Is one easier to write and why?
>
> golang seems to handle the multiple connections by using light weight
> threads. That seems heavier than epoll(), so any answer that says their
> are equivalent, I would appreciate and explanation of why threads don't
> cause a problem.
>
> From my reading, it seems golang seems particularly suitable for this,
> but I would like an experience golang dev confirm that.
>
I'd agree, it was fun to rewrite my app in Go, it's very simple and very
robust. Beside slightly elevated memory usage due to a lot of keepalive
connections (I also had to increase the number of file descriptors
available), the app is very performant.
Regards,
--
Zlatko