<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
 
<br>Our website load testing system system, <A HREF="http://www.stressmy.com">http://www.stressmy.com</A> is
very much like an agent-based simulation.  My experience in running 
on Linux is that the system bogs down on a few hundred threads.  (This
is the 2.2 kernel, 2.4 is supposed to be better).  We recently started
using select() in a single threaded model for this reason.  What platform
are you running on?  How many threads did your prototype manage?
<p>Courageous wrote:
<blockquote TYPE=CITE>I've been recently working on a agent-based simulation
system which is
<br>intended to run with massive numbers of threads in the 15,000-30,000
range.
<p>In my initial prototype of the system, I selected Python with Continuations
<br>as a base, and crafted the simulation core in about two man-weeks.
This
<br>core performed well enough at the time, but certain that I could do
better,
<br>I decided to use the Python core as a proof-of-concept, and rewrote
the
<br>core in C++. This took approximately eight man-weeks of my time and
was
<br>quite labor intensive.
<p>Having completed both cores, and with the C++ core HIGHLY OPTIMIZED,
<br>I was finally able to perform a performance test of the the C++ system
<br>versus the Python system. To my surprise, the C++ core only beat Python
<br>by about 30%. Given the obvious inequities in coding time in both efforts,
<br>plus whatever future coding time inequities I might project onto users
of
<br>either core by implication of the programming language, I was quite
<br>surprised by these results.
<p>In retrospect, it's the lack of a true continuation model in C++ which
is to
<br>blame. The C++ implementation suffers from extensive context-switching
<br>burden, having to frequently swap out all the registers and manage
the
<br>stacks for all the threads, whereas Python-with-Continuations does
not.
<p>This was an interesting outcome, which I'm still exploring.
<p>It may very well be that the C++ system shows better gains when the
<br>performance tests involve non-trivial code in the threads.
<p>However, it's still remarkable that a Python implementation of a relatively
<br>complex system like this one (an massively-parallel agent simulator),
<br>could come as close to C++ so easily.
<p>One caveat: to those who know simulation engines, the priority heap
<br>at the heart of the Python system was an optimized C-extension.
<p>Joe Kraska
<br>BBN Technologies
<br>San Diego CA</blockquote>

<pre>-- 
Doug Fort <dougfort@downright.com>
Senior Meat Manager 
Downright Software LLC</pre>
 </html>