Discussion:
[Maya-Python] XML-RPC
Marcus Ottosson
2015-05-20 15:11:42 UTC
Permalink
Does anyone have experience with it? What are your thoughts, compared to
other forms of RPC?

- https://docs.python.org/2/library/simplexmlrpcserver.html

I found it hidden away amongst the default Python libraries and am quite
astounded by it’s simplicity.

# From within Mayafrom SimpleXMLRPCServer import
SimpleXMLRPCServerimport threading
from maya import cmds

server = SimpleXMLRPCServer(("127.0.0.1", 8000))
server.register_function(cmds.createNode)

t = threading.Thread(target=server.serve_forever)
t.daemon = True
t.start()

And then, from a terminal.
import xmlrpclib>>> proxy = xmlrpclib.ServerProxy("http://127.0.0.1:8000/")>>> proxy.createNode("mesh")'polySurfaceShape1'
Resources:

- pymotw1
<http://pymotw.com/2/SimpleXMLRPCServer/index.html#module-SimpleXMLRPCServer>
- pymotw2 <http://pymotw.com/2/xmlrpclib/>

​
--
*Marcus Ottosson*
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBOaQfQ0k2_dLavXb0zDOOR6%2Bt%2Bb%3DpjWz7mMdrBWKDvTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2015-05-20 19:57:14 UTC
Permalink
I don't have much to say in either direction, since I have never used the
builtin xml-rpc in my own server/client solution. But I think I used it
once to connect to an instance of supervisor (the python-based process
manager), which does expose an xml-rpc endpoint so that you can control it.
Seems like xml-rpc is probably a lower performance solution that is good
when you just need to send less frequent calls. Since it uses xml and makes
httprequests, it has extra overhead in both the connection and the
protocol.
Also, I think the builtin server in the python standard lib might be there
for lower performance needs. The server isn't a serious production grade
and most likely handles a single request at a time. I believe it also fully
tears down the connection after each call, as opposed to solutions that
could use keep-alive.

But it probably works just fine for the situation you outlined, where you
are sending control commands to a local Maya. I doubt you would want to
stand up a server and hit it with 10 clients.
Post by Marcus Ottosson
Does anyone have experience with it? What are your thoughts, compared to
other forms of RPC?
- https://docs.python.org/2/library/simplexmlrpcserver.html
I found it hidden away amongst the default Python libraries and am quite
astounded by it’s simplicity.
# From within Mayafrom SimpleXMLRPCServer import SimpleXMLRPCServerimport threading
from maya import cmds
server = SimpleXMLRPCServer(("127.0.0.1", 8000))
server.register_function(cmds.createNode)
t = threading.Thread(target=server.serve_forever)
t.daemon = True
t.start()
And then, from a terminal.
import xmlrpclib>>> proxy = xmlrpclib.ServerProxy("http://127.0.0.1:8000/")>>> proxy.createNode("mesh")'polySurfaceShape1'
- pymotw1
<http://pymotw.com/2/SimpleXMLRPCServer/index.html#module-SimpleXMLRPCServer>
- pymotw2 <http://pymotw.com/2/xmlrpclib/>
​
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBOaQfQ0k2_dLavXb0zDOOR6%2Bt%2Bb%3DpjWz7mMdrBWKDvTw%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBOaQfQ0k2_dLavXb0zDOOR6%2Bt%2Bb%3DpjWz7mMdrBWKDvTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2p5vYZTsvgO7Kysz3tSqGGYho6gzbGZ%3Don%2BHnewwYimA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2015-05-20 20:33:52 UTC
Permalink
Thanks Justin.

It does actually support concurrent responses, both threaded and forked, so
I wouldn't be surprised if it could scale quite a bit as-is.

On my machine, it handles around 1600 (synchronous) requests/second.

Out of curiosity, I'll have a quick look to see what threading or forking
can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction to me
is standard library inclusion.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2015-05-20 20:50:27 UTC
Permalink
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and forked,
so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or forking
can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction to
me is standard library inclusion.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2015-05-21 06:08:47 UTC
Permalink
I wasn’t really having any problems with it, I was more wondering whether
any of you had had any experience with it.

Considering it’s from 2001-2002, has a rather ugly import (with non-PEP08
names) spread across two top-level modules (for client and server) and
contains the word “XML”, I can understand how a first impression might have
gotten spoiled.

But it looks and works great.

It also supports batched calls; as in gathering up any number of RPC and
sending them through a single request. I wish I came across this ages ago.
:O

Some tests, with a single provider and consumer. Not fair, probably, it
should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.

*Synchronous 1600/sec*

from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
def null():
return True

server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()

*Threaded 1222/sec*

from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
def null():
return True
class ThreadedServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
pass

server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()

*Forked 380/sec*

from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
def null():
return True
class ForkingServer(SocketServer.ForkingMixIn, SimpleXMLRPCServer):
pass

server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()

*Test*

$ python -m timeit "import xmlrpclib;p =
xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null()
for x in xrange(100)]"

​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and forked,
so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or forking
can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction to
me is standard library inclusion.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2015-05-21 06:21:37 UTC
Permalink
Ya like I said, I didn't have any concrete experience to offer. It seems
like it will work great for your use case. And if you needed multiple
clients to be able to connect, and they all handle reasonably well, then
why not.
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering whether
any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with non-PEP08
names) spread across two top-level modules (for client and server) and
contains the word “XML”, I can understand how a first impression might have
gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC and
sending them through a single request. I wish I came across this ages ago.
:O
Some tests, with a single provider and consumer. Not fair, probably, it
should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and forked,
so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction
to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2015-05-21 06:30:34 UTC
Permalink
I just discovered this, gives some perspective to the performance of the
built-in Python version.

- http://xmlrpc-c.sourceforge.net/performance.php

Using C, a client program starts (exec()), does 100 RPCs, and exits in 380
milliseconds. With just one RPC, it’s 26 ms. By calculation, this means the
time for just an RPC is about 4 ms, about 280 RPCs per second.

A tad sceptical that Python outperforms C though. :S
​
Post by Justin Israel
Ya like I said, I didn't have any concrete experience to offer. It seems
like it will work great for your use case. And if you needed multiple
clients to be able to connect, and they all handle reasonably well, then
why not.
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering whether
any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with non-PEP08
names) spread across two top-level modules (for client and server) and
contains the word “XML”, I can understand how a first impression might have
gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC and
sending them through a single request. I wish I came across this ages ago.
:O
Some tests, with a single provider and consumer. Not fair, probably, it
should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and
forked, so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction
to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2015-05-21 06:38:01 UTC
Permalink
Interesting info. It talks about one of its implementations eliminating the
use of http. Although the standard python lib one, I believe uses an http
protocol. Also, if you aren't using that multicmd thing, then I believe
each http connection is fully torn down each time.
Post by Marcus Ottosson
I just discovered this, gives some perspective to the performance of the
built-in Python version.
- http://xmlrpc-c.sourceforge.net/performance.php
Using C, a client program starts (exec()), does 100 RPCs, and exits in
380 milliseconds. With just one RPC, it’s 26 ms. By calculation, this means
the time for just an RPC is about 4 ms, about 280 RPCs per second.
A tad sceptical that Python outperforms C though. :S
​
Post by Justin Israel
Ya like I said, I didn't have any concrete experience to offer. It seems
like it will work great for your use case. And if you needed multiple
clients to be able to connect, and they all handle reasonably well, then
why not.
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering
whether any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with
non-PEP08 names) spread across two top-level modules (for client and
server) and contains the word “XML”, I can understand how a first
impression might have gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC and
sending them through a single request. I wish I came across this ages ago.
:O
Some tests, with a single provider and consumer. Not fair, probably, it
should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and
forked, so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main attraction
to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2015-05-21 06:48:22 UTC
Permalink
then I believe each http connection is fully torn down each time.

What does that mean? Is it of performance concern, or something else?
​
Post by Justin Israel
Interesting info. It talks about one of its implementations eliminating
the use of http. Although the standard python lib one, I believe uses an
http protocol. Also, if you aren't using that multicmd thing, then I
believe each http connection is fully torn down each time.
Post by Marcus Ottosson
I just discovered this, gives some perspective to the performance of the
built-in Python version.
- http://xmlrpc-c.sourceforge.net/performance.php
Using C, a client program starts (exec()), does 100 RPCs, and exits in
380 milliseconds. With just one RPC, it’s 26 ms. By calculation, this means
the time for just an RPC is about 4 ms, about 280 RPCs per second.
A tad sceptical that Python outperforms C though. :S
​
Post by Justin Israel
Ya like I said, I didn't have any concrete experience to offer. It seems
like it will work great for your use case. And if you needed multiple
clients to be able to connect, and they all handle reasonably well, then
why not.
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering
whether any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with
non-PEP08 names) spread across two top-level modules (for client and
server) and contains the word “XML”, I can understand how a first
impression might have gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC
and sending them through a single request. I wish I came across this ages
ago. :O
Some tests, with a single provider and consumer. Not fair, probably, it
should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and it
seemed pretty basic. So if it gets you the performance you are after, then
that solves a problem.
On Thu, May 21, 2015 at 8:33 AM Marcus Ottosson <
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and
forked, so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main
attraction to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBShBrJMBdCiD_TPvkhHGvRyZd9VLJ8aAXyHq6mwKnwNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2015-05-21 06:54:55 UTC
Permalink
Post by Marcus Ottosson
then I believe each http connection is fully torn down each time.
What does that mean? Is it of performance concern, or something else?
http://en.wikipedia.org/wiki/HTTP_persistent_connection

And an example, in practice, via the python requests library:
http://docs.python-requests.org/en/latest/user/advanced/#keep-alive

The idea being that if you can keep your http connection alive, then it can
wait for the next request and avoid the whole set up and tear down of a
full http connection. But when I glanced at the source for the
SimpleXMLRPCServer, it seemed to completely shutdown the connection after
each request. This just means its not a fancy server, as indicated by the
"simple" prefix.
Post by Marcus Ottosson
​
Post by Justin Israel
Interesting info. It talks about one of its implementations eliminating
the use of http. Although the standard python lib one, I believe uses an
http protocol. Also, if you aren't using that multicmd thing, then I
believe each http connection is fully torn down each time.
Post by Marcus Ottosson
I just discovered this, gives some perspective to the performance of the
built-in Python version.
- http://xmlrpc-c.sourceforge.net/performance.php
Using C, a client program starts (exec()), does 100 RPCs, and exits in
380 milliseconds. With just one RPC, it’s 26 ms. By calculation, this means
the time for just an RPC is about 4 ms, about 280 RPCs per second.
A tad sceptical that Python outperforms C though. :S
​
Post by Justin Israel
Ya like I said, I didn't have any concrete experience to offer. It
seems like it will work great for your use case. And if you needed
multiple clients to be able to connect, and they all handle reasonably
well, then why not.
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering
whether any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with
non-PEP08 names) spread across two top-level modules (for client and
server) and contains the word “XML”, I can understand how a first
impression might have gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC
and sending them through a single request. I wish I came across this ages
ago. :O
Some tests, with a single provider and consumer. Not fair, probably,
it should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and
it seemed pretty basic. So if it gets you the performance you are after,
then that solves a problem.
On Thu, May 21, 2015 at 8:33 AM Marcus Ottosson <
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and
forked, so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main
attraction to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBShBrJMBdCiD_TPvkhHGvRyZd9VLJ8aAXyHq6mwKnwNQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBShBrJMBdCiD_TPvkhHGvRyZd9VLJ8aAXyHq6mwKnwNQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA39fPS3B_qYKzfKAriWy%3DjPa6A%3DgvBj7sB0DPyKUXbL-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2015-05-21 07:06:18 UTC
Permalink
Ah, thanks. I'll have a look through those links.
Post by Justin Israel
Post by Marcus Ottosson
then I believe each http connection is fully torn down each time.
What does that mean? Is it of performance concern, or something else?
http://en.wikipedia.org/wiki/HTTP_persistent_connection
http://docs.python-requests.org/en/latest/user/advanced/#keep-alive
The idea being that if you can keep your http connection alive, then it
can wait for the next request and avoid the whole set up and tear down of a
full http connection. But when I glanced at the source for the
SimpleXMLRPCServer, it seemed to completely shutdown the connection after
each request. This just means its not a fancy server, as indicated by the
"simple" prefix.
Post by Marcus Ottosson
​
Post by Justin Israel
Interesting info. It talks about one of its implementations eliminating
the use of http. Although the standard python lib one, I believe uses an
http protocol. Also, if you aren't using that multicmd thing, then I
believe each http connection is fully torn down each time.
Post by Marcus Ottosson
I just discovered this, gives some perspective to the performance of
the built-in Python version.
- http://xmlrpc-c.sourceforge.net/performance.php
Using C, a client program starts (exec()), does 100 RPCs, and exits
in 380 milliseconds. With just one RPC, it’s 26 ms. By calculation, this
means the time for just an RPC is about 4 ms, about 280 RPCs per second.
A tad sceptical that Python outperforms C though. :S
​
Post by Justin Israel
Ya like I said, I didn't have any concrete experience to offer. It
seems like it will work great for your use case. And if you needed
multiple clients to be able to connect, and they all handle reasonably
well, then why not.
On Thu, May 21, 2015 at 6:08 PM Marcus Ottosson <
Post by Marcus Ottosson
I wasn’t really having any problems with it, I was more wondering
whether any of you had had any experience with it.
Considering it’s from 2001-2002, has a rather ugly import (with
non-PEP08 names) spread across two top-level modules (for client and
server) and contains the word “XML”, I can understand how a first
impression might have gotten spoiled.
But it looks and works great.
It also supports batched calls; as in gathering up any number of RPC
and sending them through a single request. I wish I came across this ages
ago. :O
Some tests, with a single provider and consumer. Not fair, probably,
it should probably use multiple consumers to show a difference here, but
singles is all I’m looking for personally.
*Synchronous 1600/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
server = SimpleXMLRPCServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Threaded 1222/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ThreadedServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Forked 380/sec*
from SimpleXMLRPCServer import SimpleXMLRPCServerimport SocketServer
return True
pass
server = ForkingServer(("0.0.0.0", 80), logRequests=False)
server.register_function(null)
server.serve_forever()
*Test*
$ python -m timeit "import xmlrpclib;p = xmlrpclib.ServerProxy('http://192.168.131.153:8000');print p;[p.null() for x in xrange(100)]"
​
Post by Justin Israel
Awesome. I only glanced at the standard library implementation, and
it seemed pretty basic. So if it gets you the performance you are after,
then that solves a problem.
On Thu, May 21, 2015 at 8:33 AM Marcus Ottosson <
Post by Marcus Ottosson
Thanks Justin.
It does actually support concurrent responses, both threaded and
forked, so I wouldn't be surprised if it could scale quite a bit as-is.
On my machine, it handles around 1600 (synchronous) requests/second.
Out of curiosity, I'll have a quick look to see what threading or
forking can do about it. Alternatively, I also found this
<http://sourceforge.net/projects/py-xmlrpc/>, but the main
attraction to me is standard library inclusion.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCOgXDFPLNuK_Pn%2BDsTEtY2FsDfnnYujYkMnTxeiE5cXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2iRDvXk2rXJdx4Cm1LTP9qviiDFUWAjf_1FdTqX_WAEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it,
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODjOVSDP32Jk%3D2%3Dp5JB7ZGeaWuPj7r2sgu5YYN6nwnrPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3MoTvAP4W1fig-eQFBWKB_ZNPHv0Oxpr9VtPYU068CrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALwOMc_Tf-DNp%3D_reZofEk%3D%2BcD0SBoN8Ek35oQVxAzoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
Post by Justin Israel
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA29eHoTyJVZSgb8%2BmJKGNhUQ4sKZXvOLMqU2wVGk5OOcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBShBrJMBdCiD_TPvkhHGvRyZd9VLJ8aAXyHq6mwKnwNQ%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBShBrJMBdCiD_TPvkhHGvRyZd9VLJ8aAXyHq6mwKnwNQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA39fPS3B_qYKzfKAriWy%3DjPa6A%3DgvBj7sB0DPyKUXbL-A%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA39fPS3B_qYKzfKAriWy%3DjPa6A%3DgvBj7sB0DPyKUXbL-A%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
*Marcus Ottosson*
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAUr07W7OUORF%3DteF8hXQy2ZxtZP%3DmocgbT3AUMdvx9Lg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
zhen huang
2018-01-27 14:14:08 UTC
Permalink
Hi Marcus , Justin ,

If I just want to use it as remotely standalone mayapy which control by my
currently GUI maya . how can I register all maya command inside ? ( The
purpose is to fully remotely control the standalone mayapy ) , appreciate
if you guys can answer this question from a junior , thanks a lot !

圚 2015幎5月20日星期䞉 UTC+8䞋午11:11:46Marcus Ottosson写道
Post by Marcus Ottosson
Does anyone have experience with it? What are your thoughts, compared to
other forms of RPC?
- https://docs.python.org/2/library/simplexmlrpcserver.html
I found it hidden away amongst the default Python libraries and am quite
astounded by it’s simplicity.
# From within Mayafrom SimpleXMLRPCServer import SimpleXMLRPCServerimport threading
from maya import cmds
server = SimpleXMLRPCServer(("127.0.0.1", 8000))
server.register_function(cmds.createNode)
t = threading.Thread(target=server.serve_forever)
t.daemon = True
t.start()
And then, from a terminal.
import xmlrpclib>>> proxy = xmlrpclib.ServerProxy("http://127.0.0.1:8000/")>>> proxy.createNode("mesh")'polySurfaceShape1'
- pymotw1
<http://pymotw.com/2/SimpleXMLRPCServer/index.html#module-SimpleXMLRPCServer>
- pymotw2 <http://pymotw.com/2/xmlrpclib/>
​
--
*Marcus Ottosson*
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7c34be2a-daa8-47ea-a01d-6a6a4d789503%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2018-01-27 14:24:35 UTC
Permalink
Without having tested this, and it being 3 years since I first wrote it,
something like this might do the trick.

Replace this..

server.register_function(cmds.createNode)

With this..

for function in dir(cmds):
server.register_function(getattr(cmds, function))

Now you’ll have registered every single function in cmds and *should* be
able to call them remotely.

Use at your own risk! :)
​
​
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODOV%2BLv2NEYnTjYLmtXBVbbsX34%2B27JyCTBA-yhJLcOEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Zhen Huang
2018-09-26 06:17:40 UTC
Permalink
Hi Marcus ,

Awesome!

Thanks ,


圚 2018幎1月27日星期六 UTC+8䞋午10:24:45Marcus Ottosson写道
Post by Marcus Ottosson
Without having tested this, and it being 3 years since I first wrote it,
something like this might do the trick.
Replace this..
server.register_function(cmds.createNode)
With this..
server.register_function(getattr(cmds, function))
Now you’ll have registered every single function in cmds and *should* be
able to call them remotely.
Use at your own risk! :)
​
​
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e2b065dc-6978-4271-8de3-e8731e5de3d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...