What is Megaphone?

What is Megaphone?
The Megaphone project is about enhancing open source chat software. Specifically, the goal is to allow ejabberd to support 1,000,000 simultaneous users. See The Plan page for more details on how I plan to solve this problem. See the About this Blog page for more details on why I created this blog.

Monday, March 5, 2012

megaphone Listeners and a Milestone of Sorts


Previously...
  • I got my old computer working (go me!)
  • Investigation revealed that ECM is sending raw TCP traffic to megaphone.
  • I determined that megaphone needed to listen for new connections.

In addition to whatever other doggerel that I put down in this post, this is also the 100th post for this blog.  This is a mixed event.  It's good that I've managed to stick with this project for something like 90 days, but, on the other hand, it's bad that it's taken so long.  

Regarding the current situation, megaphone needs to watch for new connections and then kick off ejabberd_http_bind when a new connection is detected.  One way to detect new connections is to simply assume that any message from the client constitutes a new connection - so whenever megaphone gets a packet from megaphone_receiver, it signals a new connection.  

If clients use the HTTP keep-alive header, or if clients use HTTP 1.1 then it seems like this could be a problem.  Looking at the packets that pidgin uses, it appears that pidgin does use HTTP 1.1  

According to wikipedia:

In HTTP 1.1 all connections are considered persistent unless declared otherwise.[1] The HTTP persistent connections do not use separate keepalive messages, they just allow multiple requests to use a single connection.

Therefore, it seems like pidgin could conceivably send multiple BOSH messages using the same connection.

In the spirit of doing the simplest thing that could possibly work, I think I will just keep track of the largest connection ID that megaphone has seen so far.  If a message uses a connection ID that is larger, then megaphone will assume it is a new connection and kick off another ejabberd_http_bind.  Otherwise, megaphone can assume that this is an existing connection.

Next time: yes, but does that actually work? 

No comments:

Post a Comment