[zeromq-dev] autoconf troubles, and perftest problems.

Omri Schwarz omri.schwarz at phasecap.com
Mon May 4 23:03:19 CEST 2009


----- "Omri Schwarz" <omri.schwarz at phasecap.com> wrote: 
> 
> Hi, all. I am trying to build a store&forward daemon using 0MQ & Python , and am just learning the ropes. 
> 
> I have ZMQ 0.6 on a Centos 5 system with Python 2.6. When I run the performance tests, I get this: 
> 
> 
> [omri at gort1 zmq]$ python py_remote_lat.py localhost eth0 eth0 1 1024 
> [omri at gort1 zmq]$ 
> 
> [omri at gort1 zmq]$ python py_local_lat.py localhost 1 1024 
> message size: 1 [B] 
> roundtrip count: 1024 
> Your average latency is 115 [us] 
> 
> But up the message size, and this happens: 
> 
> [omri at gort1 zmq]$ python py_remote_lat.py localhost eth0 eth0 10 1024 
> [omri at gort1 zmq]$ python py_local_lat.py localhost 10 1024 
> message size: 10 [B] 
> roundtrip count: 1024 
> Traceback (most recent call last): 
> File "py_local_lat.py", line 65, in <module> 
> main () 
> File "py_local_lat.py", line 57, in main 
> assert msg_size == message_size 
> AssertionError 
> 
> For some reason the incoming messages remain one byte long. 
> 

For some followup, I should have added that I am running on x86_64, and that the 
code for Zmq.send() uses PyString_Size , which comes with this warning: 

Py_ssize_t PyString_Size ( PyObject *string ) ¶ 

Return the length of the string in string object string . 

Changed in version 2.5: This function returned an int type. This might require changes in your code for properly supporting 64-bit systems. What integer size does the zmq::message_t object use for its size? 32 bits? 



PyObject *pyZMQ_send (pyZMQ *self, PyObject *args, PyObject *kwdict) 
{ 
PyObject *py_message = PyString_FromStringAndSize (NULL, 0); 
int exchange = 0; 
bool block = true; 
bool sent = false; 

static const char *kwlist [] = {"exchange", "py_message", "block", NULL}; 

if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iSb", (char**) kwlist, 
&exchange, &py_message, &block)) 
return NULL; 

zmq::message_t message (PyString_Size (py_message)); 
memcpy (message.data (), PyString_AsString (py_message), message.size ()); 
sent = self->api_thread->send (exchange, message, block); 

return PyInt_FromLong (sent ? 1 : 0); 
} 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090504/c521abb9/attachment.htm>


More information about the zeromq-dev mailing list