You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Piotr Nowojski (JIRA)" <ji...@apache.org> on 2013/04/10 14:08:19 UTC

[jira] [Commented] (THRIFT-1848) Python asynchronous server

    [ https://issues.apache.org/jira/browse/THRIFT-1848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627710#comment-13627710 ] 

Piotr Nowojski commented on THRIFT-1848:
----------------------------------------

I have rebased my changes with the latest origin/master and removed Makefiles. I have also added some very simple unittest for TNonblockingServer.Worker class. To be honest I'm not sure how one can easily write unittest for whole TNonblockingServer class. Especially, because it's being tested quite extensively by "thrift/test/py/RunClientServer.py TNonblockingServer" command.
                
> Python asynchronous server
> --------------------------
>
>                 Key: THRIFT-1848
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1848
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Python - Compiler, Python - Library
>    Affects Versions: 1.0, 1.1, 1.2
>            Reporter: Piotr Nowojski
>         Attachments: thrift-1848-python-async-server.patch, thrift-1848-python-async-server-v2.patch
>
>
> As far as I know, there is no support in python for anything else, then 
> blocking communication/non-blocking/twisted. Non-blocking is not 
> asynchronous and we definitely don't want to use twisted. I'm really 
> interested in adding support for onCompleted/onError callbacks model. 
> After small research, I've found couple of discussions/complains about 
> missing such functionality.
> The main idea is to allow users (for example my project in my company...) to create single threaded thrift servers, with one thread processing all thrift requests AND user created events. Support for custom events (and events loop) is done, by adding support for "step()" method in WorkerAsync(), which is being 
> called at least once a given timeout. Example code is in the tutorial py.async. 
> I have added "sleep(duration)" command to the py.async PythonServer which is being invoked on PythonClient, which sleeps for given number of seconds (1.5 in PythonClient). 
> console1: ./PythonServer.py
> console2: for i in {1..100}; do ./PythonClient.py & done
> Second console will complete within ~2 seconds with only one thread on the server. On TSimpleServer, TNonblockingServer or TThreadPoolServer with about 10 threads, it would take much more time to complete.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira