IRC Log


Sunday April 11, 2010

[Time] NameMessage
[05:59] CIA-5 zeromq2: 03Martin Sustrik 07master * r6fea422 10/ include/zmq.hpp : getsockopt added to c++ binding - http://bit.ly/aWN1od
[08:08] mikko sustrik: pretty early commit, huh
[08:08] mikko (assuming you are somewhat close to GMT)
[08:08] sustrik GMT+1
[08:09] sustrik what about you?
[08:09] mikko GMT + 1 at the moment i think
[08:09] mikko british summer time
[08:09] mikko (london)
[08:10] sustrik ah, GMT+2 here then (CET summer time)
[08:10] mikko is imatix a belgian company?
[08:11] mikko at least the contact details seem to point to belgium
[08:11] sustrik imatix is belgain, but i am independent, just managing the project
[08:11] sustrik i'm based in bratislava, slovakia
[08:12] sustrik btw, i'll have to go to london next week or so, so we can have a beer
[08:12] mikko sure, just let me know when and where
[08:12] sustrik ack
[08:12] mikko i visited bratislava in 2006
[08:13] sustrik haven't changed much since :)
[08:13] mikko after football world cup
[08:13] mikko a lot of road works
[08:13] sustrik still the same
[08:13] mikko seems like the whole city was being rebuilt
[08:13] sustrik that's how cities look in balkans
[08:14] sustrik like they are rebuilt all the time
[08:14] sustrik bratislava is a bit on edge of the area
[08:14] sustrik but the impression is the same
[08:15] sustrik btw, how does the php api look like?
[08:15] sustrik i think i've noticed you are using 'zeromq' prefix
[08:15] mikko i tagged 0.1.0 beta
[08:15] sustrik yep, seen that
[08:16] sustrik some time ago we've tried to write a guidelines for APIs so that all the language bindings look more or less the same
[08:16] mikko yep, class name in php can't start with a number
[08:16] sustrik have tou seen that?
[08:16] mikko no, missed that
[08:16] sustrik wait a sec
[08:16] mikko it's an easy change if needed
[08:16] sustrik http://www.zeromq.org/guidelines:bindings
[08:17] sustrik it's entirely up to you
[08:17] sustrik but following the guidelines is meant to ease the transition between different languages
[08:17] sustrik as well as to make communication between developers in different languages easier
[08:18] mikko Preferred name of the object/namespace/prefix is "zmq"
[08:18] sustrik yes
[08:18] mikko let me change that
[08:26] CIA-5 zeromq2: 03Martin Sustrik 07master * r00cf3ce 10/ (include/zmq.h src/socket_base.cpp src/socket_base.hpp): multi-part message functionality available via ZMQ_SNDMORE and ZMQ_RCVMORE - http://bit.ly/aKIAhA
[08:40] mikko i renamed the extension from 'zeromq' to 'zmq' as well
[08:40] mikko Search -> Replace All
[08:40] mikko :)
[08:40] sustrik mikko: great, thanks
[08:51] mikko repo renamed, links updated, docs update
[08:52] mikko i think it's almost done
[08:58] sustrik mikko: you've already done the poll part, right?
[08:58] mikko yep
[08:58] sustrik as you've seen in the guidelines there's no standard for polling API at the moment
[08:58] sustrik on the mailing list there's a thread called "polling API"
[08:59] sustrik i would be gread if you can comment on what the API looks like in PHP
[08:59] sustrik the ultimate goal is to get some common understanding how polling interface should look like to be acceptable for all languages
[09:00] mikko i modelled the polling interface after existing "select" api in php
[09:01] mikko so it would be somewhat familiar for the developer already
[09:01] mikko i'll take a look
[09:01] sustrik thx
[09:02] mikko hm, i actually hid away the context from the developer
[09:03] mikko due to the complexicity of persistent resources in php
[09:03] mikko inside one process i create one context per combination of options which is persisted based on configuration setting which can be set by administrator
[09:03] mikko that way in shared hosting scenario the admins can disable persistence altogether
[09:12] mikko is there any reason why you didn't use existing event loop libraries for polling?
[09:12] mikko such as libev
[09:15] sustrik mikko: how would you do that?
[09:15] sustrik 0mq socket is not a file descriptor
[09:16] sustrik as for the context, it's intent is to separate different applications running in the same process
[09:16] sustrik if PHP doesn't allow that kind of thing, there's no point in having context object exposed
[09:17] mikko i don't think for 99.9% of phps usecases context object is not needed
[09:17] mikko as sharing context inside a php script should be advantage rather than harmful
[09:18] mikko if there are other extensions that use zeromq they would have their own context
[09:18] sustrik it was originally designed for C
[09:18] mikko usually i tend to try to design with simplicity in mind for php :)
[09:18] sustrik the use case was that if there are 2 libraries, each using 0MQ
[09:18] mikko yeah, in C it makes a lot of sense
[09:18] sustrik you can link them to the same process
[09:18] sustrik without them misiteracting
[09:19] sustrik exactly, if a misinteraction probelm cannot happen in PHP there's no point in having context
[09:20] mikko hmm, how does the polling work in 0mq at the moment?
[09:20] mikko i would've thought that it checks for io at some point
[09:20] sustrik I/O is done in I/O threads
[09:21] sustrik what you are checking in zmq_poll is whether there are messages queued by I/O threads
[09:21] sustrik destined for application threads
[09:21] sustrik it's done via a lock-free polling object
[09:21] sustrik ypollset.hpp
[09:21] sustrik iirc
[09:22] sustrik but the real point is that there's no way to simulate an fd in user space
[09:22] sustrik so you can either go kernel
[09:22] sustrik thus loosing portability
[09:23] sustrik or you sacrifice fd's
[09:24] sustrik the latter means that system polling mechanism - such as select of poll - cannot be used with your implementation
[09:24] sustrik :(
[09:24] mikko now i get it
[09:24] mikko i've only used event loops in very simple scenarios
[09:24] mikko such as websocket daemon etc
[09:24] mikko where there is a writable/readable fd
[09:24] sustrik ack
[09:25] sustrik when /me is rich and powerful, i'll loby for adding user-space fds to POSIX
[09:27] mikko http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_prepare_code_and_code_ev_che
[09:27] mikko "Their main purpose is to integrate other event mechanisms into libev and their use is somewhat advanced. They could be used, for example, to track variable changes, implement your own watchers, integrate net-snmp or a coroutine library and lots more."
[09:28] mikko that might be fd based as well
[09:29] sustrik not sure
[09:30] sustrik maybe its just a way to to say "use zmq_poll instead of poll"
[09:30] sustrik and 0mq sockets instead of fds
[09:31] sustrik hm, looking at the example, it's probably fd-based
[09:32] mikko "The drawback with this solution is that the main loop is now no longer controllable by EV. The Glib::EV module uses this approach, effectively embedding EV as a client into the horrible libglib event loop."
[09:33] mikko the author does not seem to be the most polite person
[09:34] sustrik :)
[09:34] sustrik but that seems to imply you can actually merge it with 0mq
[09:35] sustrik i am not sure i understand it correctly
[09:35] sustrik but does it mean you can delegate the actuall polling to zmq_poll
[09:35] sustrik ?
[09:35] mikko i think event_poll_func is a callback for Glib::EV
[09:35] mikko yes, seems like that
[09:36] sustrik ok, if someone appears with a need for libev integration, let's point him this way
[11:21] mikko sustrik: is the maximum size for ZMQ_IDENTITY exposed somehow?
[11:24] sustrik it's 255
[11:24] sustrik you mean like a constant or so?
[11:25] mikko i mean is that subject to change?
[11:25] sustrik no, it's not
[11:25] sustrik 255 characters should be enough
[11:33] sustrik mikko: do you expect longer identites?
[11:33] mikko no, just that if i hardcore the value and it changes in the future
[11:33] sustrik strictly speaking, there's no real technological reason to limit the size of identity
[11:34] sustrik in theory it can be made unbound
[11:35] sustrik having identities longer than 255 characters is not a good idea
[11:35] sustrik but why limit those that want to do this kind of ugly stuff?
[11:36] mikko retrieving is easier if its limited
[11:36] sustrik true
[11:36] sustrik a different question: should the identity even be retrievable?
[11:36] sustrik what is it good for?
[11:37] mikko well, in case of php you might instantiate the object and then use it a few requests later
[11:37] mikko effectively the socket is persisted and then tied to a new php object later
[11:38] sustrik right, but why would you want to retrieve the identity?
[11:38] mikko you mean instead of resetting it each time?
[11:39] sustrik the question is what's the scenario where you need getsockopt (ZMQ_IDENTITY)?
[11:40] mikko let's a say you got a following php script: <?php $object = new ZMQ(ZMQ::SOCKET_REP, 'mysock1'); ?>
[11:40] mikko the socket structure is stored internally over multiple executions of this script
[11:41] mikko to get persistent connections
[11:41] mikko now, let's say you have an identity
[11:41] mikko the script becomes <?php $object = new ZMQ(ZMQ::SOCKET_REP, 'mysock1'); $object->setSockOpt(ZMQ::SOCKOPT_IDENTITY, 'my best socket'); ?>
[11:42] mikko so on each execution of this script (page load) you would reset the identity
[11:42] mikko i dont know if that makes any difference
[11:43] mikko if you can retrieve it you could do <?php $object = new ZMQ(ZMQ::SOCKET_REP, 'mysock1'); if ($object->getSockOpt(ZMQ::SOCKOPT_IDENTITY) != 'my best socket') { $object->setSockOpt(ZMQ::SOCKOPT_IDENTITY, 'my best socket'); }
[11:43] sustrik the identity is meant to stay the same
[11:43] sustrik so you open socket
[11:43] sustrik set the identity
[11:43] sustrik and that's it
[11:43] sustrik you don't need to touch it anymore
[11:44] mikko indeed, but in phps case if you can't retrieve the identity you can not know if it's set already
[11:44] mikko as the socket is persisted over multiple requests but the PHP object is recreated each time
[11:45] sustrik true, but still, setting it each time doesn't really matter
[11:45] sustrik except as performance problem
[11:45] sustrik but i would suspect there are much more perf problems in PHP itself and setting a single string shouldn't really matter
[11:46] mikko well, in C you might have a large array sockets and each one have identity set at different stages
[11:47] sustrik yes, that's the only use case i can think of
[11:49] mikko i would think it makes no harm to limit/allow retrieving
[11:49] mikko if someone needs longer identities let's cross that bridge when we get there
[11:49] sustrik ok, good
[11:49] sustrik let it stay as it is now
[12:00] CIA-5 zeromq2: 03Martin Sustrik 07master * r6cf0765 10/ include/zmq.h : C-style comments in zmq.h - http://bit.ly/dw16x4
[12:09] mikko mmm
[12:09] mikko protein bars taste horrible
[12:14] mikko hmm
[12:14] mikko one thing i was wondering that might be useful
[12:14] mikko have the libzmq version exposed as constant as well
[12:14] mikko that would show which version people compiled against vs runtime version
[12:18] sustrik yeah, it would be useful, but the version numbers are generated from configure.in
[12:18] sustrik try asking about it on the mailing list
[12:18] sustrik people who understand how the build system works may have an opinion
[12:20] CIA-5 zeromq2: 03Martin Sustrik 07master * rdff79d7 10/ builds/msvc/platform.hpp : version number bumped to 2.0.7 for MSVC build - http://bit.ly/b2cKvx
[13:45] sustrik people who understand how the build system works may have an opinion
[14:36] CIA-5 zeromq2: 03Martin Sustrik 07master * rfba28c7 10/ (6 files in 2 dirs): issue 1 - Change zmq_term semantics - http://bit.ly/c7n0NQ
[14:55] mikko reply-to "&#216;MQ development list" <zeromq-dev@lists.zeromq.org>
[14:55] mikko odd
[14:59] sustrik it've been discussed on the mailing list
[14:59] sustrik i have no opinion on it
[14:59] sustrik feel free to complain
[14:59] mikko sorry?
[14:59] sustrik the reply-to thing
[14:59] mikko ah
[14:59] mikko :)
[14:59] mikko im just wondering why it goes like that
[15:00] mikko noticed your post of zmq_term semantics and trying to formulate my idea into an email
[15:00] sustrik because people are used to hit reply button instead of reply to all
[15:00] sustrik thus the conversations tend to disappear from public view
[15:06] sustrik ah, you meant the strange character?
[15:06] sustrik "&#216;
[15:06] sustrik I've just changes that to ordinary 0
[15:06] sustrik changed*
[15:08] mikko yeah, i mean the strange character
[15:08] mikko meant*
[15:08] sustrik fixed!
[15:17] mikko my first mail to list sent
[15:18] sustrik :)
[15:18] sustrik let me reply
[16:01] mikko im gonna hit the gym
[16:01] mikko bbl
[18:47] mikko back