[vworld-tech] Python for the backend

Alex Chacha achacha at hotmail.com
Wed Apr 27 11:24:12 PDT 2005


Brian Hook wrote:
>So now I'm a Python whore, but I'm still just learning it.


I personally love python for all my scripting, but I have not had any 
success running it as a backend or frontend.  It is an interpreted language 
and when you decide on it, you are accepting performance and scaling woes 
that go along with it.

For my latest project I wanted a quick and dirty backend code so I can 
concentrate on the questing and crafting engine, all was well initially and 
then I did a small 10 client load test and saw that it just did not scale 
well at all.  Which was disappointing.  I then tried to write a simple java 
based implementation and that was a bit better but delays were huge when 
more than 15 clients were connected at the same time.  My next step was to 
go back to the trusty C++ and currently I can handle about 50 clients 
simultaneously without any noticeable delay.

Given that I did more testing with java and managed to improve performance 
by only using 10 worker threads and managed 50 client load before I started 
noticing lag.  Then I tried it with C++ and currently I can handle load of 
500 clients from 4 machines (limited by my lack of machines) and the system 
is working great.

While these tests are very specific to what I am working on, it may give you 
some ideas about what to expect in the long run.  If you plan on having 
maximum of 20 people simultaneous you can use python or java and try not to 
have 1 thread per socket or you will hit the dreaded 
"more-time-spent-on-context-switching-than-execution" problem.  If you are 
going for a lot of clients per machine then C++ is probably you best bet.  
With java and python you can always use more machines and put a load 
balancer in front, but that may be a bit costly for a small scale MUD.

++Alex




More information about the vworld-tech mailing list