gentimouton/rcat — Issue #2: Client bot
Author: gentimouton
Created: 2012-01-26 19:53:29+00:00
State: open

I think the main bottleneck when running 20 bots on a single machine is when receiving messages. In the java code, the 20 socket threads (1 per bot) most likely blocked each other all the time, whether user or kernel threads. See http://en.wikipedia.org/wiki/Thread_%28computer_science%29#I.2FO_and_scheduling

Hence, sockets should be non-blocking. That means using epoll on their file descriptors. This is low-level stuff, so there may be a python lib or project for that. Maybe from tornado?