A Million User Comet App with MochiWeb

by Dylan SchiemannOctober 17th, 2008

Richard Jones has started an article series about building A Million-user Comet Application with MochiWeb.

In this series I will detail what I found out empirically about how mochiweb performs with lots of open connections, and show how to build a comet application using mochiweb, where each mochiweb connection is registered with a router which dispatches messages to various users. We end up with a working application that can cope with a million concurrent connections, and crucially, knowing how much RAM we need to make it work.

In part one:

* Build a basic comet mochiweb app that sends clients a message every 10 seconds.
* Tune the Linux kernel to handle lots of TCP connections
* Build a flood-testing tool to open lots of connections (ye olde C10k test)
* Examine how much memory this requires per connection.

Future posts in this series will cover how to build a real message routing system, additional tricks to reduce memory usage, and more testing with 100k and 1m concurrent connections.

Erlang and MochiWeb continue to gain popularity in the Comet space. Other recent Comet Erlang stories include Roberto Saccon’s Getting Started with Comet on Erlang, and Facebook’s use of ejabberd.

4 Responses to “A Million User Comet App with MochiWeb”

  1. Martin Tyler Says:

    I look forward to seeing results of 1 million users.. shame the title of this post is about something he hasn’t actually done yet :)

  2. Martin Tyler Says:

    Part 2 is up now…


    Still no million users though :)

  3. DylanSchiemann Says:

    Or libevent with a “gazillion” connections: http://aleccolocco.blogspot.com/2008/10/gazillion-user-comet-server-with.html

  4. Martin Tyler Says:

    Part 3 is up now…


    He kept good on his claims, 1 million connections

Copyright 2015 Comet Daily, LLC. All Rights Reserved