[Twisted-Python] network server on multiprocessor hardware

Bokhan Artem art at academ.org
Fri Sep 4 16:59:45 EDT 2009


Hello.

Is there right (standard) way to write twisted network server
(tcp/web/mail/etc) which could use several cpu cores? For example,
master+workers model, where every worker doing the same job.
If so, may somebody help to wrap the sample code below?
May be some well-known twisted based software can do that?


from twisted.application import service,internet
from twisted.web import server,resource

class Simple(resource.Resource):
    isLeaf = True
    def render_GET(self, request):
        return "Hello world."

application = service.Application("http")
ServerFactory = server.Site(Simple())
ServerService = internet.TCPServer(8081, ServerFactory)
ServerService.setServiceParent(application)





More information about the Twisted-Python mailing list