| ayrnieu | integral - I won't explain it to you. |
| integral | splitter: Yes, POE's got POE::Wheel::Run and POE::Component::Generic which allow you to easy use a fork to run a blocking library whilst your main code is handling sockets and what not. |
| action | integral would be interested to know though |
| integral | would be interested to know though |
| splitter | integral, sounds good, is that possible with threads too? |
| integral | splitter: Yes, it's where a threading model tends to win err, well, "win" might be too strong |
| splitter | integral, hm, just as a thought, wouldnt it be cool if it would be possible to make a manager thread run POE to manage a load of worker threads, which are handling/calculating different things? |
| integral | That would be very interesting, but I'm not entirely sure why you'd want threads then instead of processes? Would you be using shared data? |
| splitter | integral, mh, dunno how much more resources a fork uses up in comparisation to an ithread. but maybe it would be significant if i have a few hundred or even thousand forks |
| integral | I think that one needs to be carefully benchmarked on your OS |
| ayrnieu | a hundred or even a thousand forks or threads are both probably unwise. Use threads for parallelism and for defense against blocking libraries, not for concurrency. |
| integral | Although, I guess forks on something like Linux would win; both after all use the OS scheduler (1:1 threads) so that's not an issue in either case |
| ayrnieu | For concurrency, POE is fine. |
| integral | So, in this case you'd advocate POE for the concurrency attached to a pool of processes handling the blocking library? |
| splitter | hm, in this case i was thinking of an sort of bouncer, which has to be able to handle a load of connections. ill try to make a concept which uses POE where possible |
| action | merlyn rushes to pack, having bumped up his flight 3 horus |
| merlyn | rushes to pack, having bumped up his flight 3 horus you could use HTTP on the front, and a POE::Component::Generic in the back |
| integral | HTTP? |
| merlyn | or some other light protocol in the front from whatever he's connecting from |
| integral | HTTP only does single operations (or a series of unconnected ones) though, so sure it's not quite general enough |
| merlyn | sorry, only been following the last 45 seconds |
| splitter | hm, i have to use a pre-defined protocol (and already a lib to parse it) |
| merlyn | no scrollback to speak of |
| integral | oh |
| merlyn | is the lib non-blocking? |
| splitter | yupp. thats not the problem |
| merlyn | cool so yeah, you could use POE as a mediator |
| splitter | sounds good. i like POE, but i thought i couldnt use it in this case :) |
| merlyn | write a Inline::C wrapper to your lib, and as you get callbacks, turn those into evens to post to the ::Generic in the back then you can hang an IRC bot off the side for command and control. :) and a Tk gui console for a NOC display and an NNTP client to post regular updates to the newsgroup |
| splitter | i thought it in this way: frontend <-UNIX/INET Socket-> backend which handles a lot of connections |
| merlyn | and a jabber interface so you can SMS it from your phone for control |
| splitter | well, thanks for the tips all :) |
| merlyn | tips are greatly appreciated. :) |