<br><div><span class="gmail_quote">On 6/13/07, <b class="gmail_sendername">weiwei weiwei</b> <<a href="mailto:waterinfire@hotmail.com">waterinfire@hotmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,all!<br><br><br><br> Thanks for the python twisted,it is a great software.<br><br><br><br> I am from china. This days we use twisted to develop a middleware.<br><br><br><br> Requirement is:<br><br>
1) Receive: receive 100~200 different clientĄ¯s message(they all<br>connect to our listen socket) and insert it into database(oracle)<br><br>2) Send: application insert message into db,then our middleware select
<br>message from database and send this message to its destination through<br>socket.<br><br><br><br>Our design is : reactor + adbapi.ConnectionPool<br><br>1) reactor is used in receiveing and sending message from and to
<br>socket.<br><br>2) when we received a message,we use adbapi to insert it to db<br><br>3) we use adbapi to select message from db,and use a Deferred to<br>notify us when we got a message from db,and send it to peer,after receiving
<br>the peerĄ¯s acknowledge message ,we update the databse.<br><br><br><br>After testing many times,we found when the connection number is less than<br>20,its performance is very good.But if the connection number is more than 30
<br>or 50, it is performance is worse and worse.<br><br><br><br>DO you give me some advice about the design?<br><br><br><br><br><br>Thanks in advance.<br><br><br><br><br><br>Wei wei<br><br>_________________________________________________________________
<br>Express yourself instantly with MSN Messenger! Download today it's FREE!<br><a href="http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/">http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
</a><br><br><br>_______________________________________________<br>Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br></blockquote></div><br><br>If I had to guess, I would guess you're having database performance
issues. The overhead of TCP/IP networking of 50, or even 500
simultaneous connections is nothing compared to the overhead of that
many simultaneous interactions with a database. You can figure this
out by doing some experiments, like:<br>
<br>
- run your test with a fake database which just uses an in-memory database -- if still slow then problem is in your networking, if fast then problem is in database<br><br>- if that's too difficult, another experiment would be to write some test code to run a number of simultaneous database interactions without any networking
<br>
<br>Cheers,<br>
Christian<br>
<br>
<br><span class="gmail_quote"><br><br></span>