TL;DR: Comet server with 1 million queued messages, uses ~5% cpu at 1000msgs/sec and 65m RAM, on the smallest EC2 instance.

I've just started the testing of Megacomet on a 64-bit Amazon EC2 micro instance. My first test is to get it running, and see how it goes when queuing up messages (mainly this is because I haven't yet written a test harness to pull the messages off the queue!). I'm very pleased with the results, so here's the summary:

  • Setup: 1 manager process, 8 worker processes. 64-bit Amazon linux.
  • 1 million messages queued, at 1000 messages per second (!)
  • CPU usage was tiny. Maybe 5%? And most of that was the test harness, which would in a real situation be on a different server from your comet server. Also, keep in mind this is the smallest EC2 server you can get.
  • Total memory usage was: 65m
  • Each worker averaged 8m

I'm really happy with that, both from the perspective of memory usage, and CPU usage. Keep in mind i plan to implement expiry of messages in the queue, so that in reality you'd never get a queue that large, but it's good to know that it'll queue up 1m messages without breaking a sweat.

You can find the code at: https://github.com/chrishulbert/megacomet

Here's the 'top' capture whilst running, to give you an idea of CPU usage. The 'ruby' process was the test harness:

 

top - 08:11:29 up 1 day,  2:15,  3 users,  load average: 0.00, 0.01, 0.05
Tasks:  70 total,   2 running,  68 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  2.5%sy,  0.0%ni, 96.1%id,  0.0%wa,  0.0%hi,  0.2%si,  0.5%st
Mem:    611212k total,   603348k used,     7864k free,    23904k buffers
Swap:        0k total,        0k used,        0k free,   433696k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
30333 ec2-user  20   0 28028 2736 1424 R  4.7  0.4   0:02.51 ruby               
30202 ec2-user  20   0  8668  340  264 S  3.7  0.1   0:47.10 megamanager        
30219 ec2-user  20   0 34132  25m  484 S  1.0  4.2   0:09.63 megacomet          
30223 ec2-user  20   0 17104 9040  480 S  0.7  1.5   0:03.33 megacomet          
30213 ec2-user  20   0 17104 9044  480 S  0.3  1.5   0:03.39 megacomet          
30217 ec2-user  20   0 17104 9044  480 S  0.3  1.5   0:03.30 megacomet

 

And here's the top capture at the end of the 1 million queued messages, to show the memory usage:

 

top - 06:28:46 up 1 day, 33 min,  3 users,  load average: 0.01, 0.02, 0.05
Tasks:  69 total,   1 running,  68 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.2%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    611212k total,   600784k used,    10428k free,    23840k buffers
Swap:        0k total,        0k used,        0k free,   436568k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
30219 ec2-user  20   0 32548  23m  484 S  0.0  4.0   0:09.03 megacomet          
  942 root      39  19  324m  14m 1688 S  0.0  2.5   0:00.00 yum-updatesd       
30213 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.18 megacomet          
30217 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.09 megacomet          
30225 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.07 megacomet          
30227 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.16 megacomet          
30223 ec2-user  20   0 16576 8512  480 S  0.0  1.4   0:03.11 megacomet

 

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

Software Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]
github.com/chrishulbert
linkedin



 Subscribe via RSS