Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: sysread/syswrite wrappers (select)

by tye (Sage)
on Oct 12, 2016 at 13:08 UTC ( #1173832=note: print w/replies, xml ) Need Help??


in reply to sysread/syswrite wrappers

But doing this thwarts the usual reasons for using select on said pipes. Your second call to sysread/syswrite might hang. So, no, I have never written nor used such a wrapper.

- tye        

Replies are listed 'Best First'.
Re^2: sysread/syswrite wrappers (select)
by vsespb (Chaplain) on Oct 12, 2016 at 13:27 UTC
    Ok, technically you are right, that is good answer to my question.
    Usually in my case messages are small and "rare".
    i.e. there is on master process, which receives messages from child processes. And select() loop in master process. But when master determines that there is the message from some child, it tries to read full message, without trying to multiplex between two childs and reading message from both at time.
    So, after select() told filehandle is readable, I read whole message from child, and during that process do not select() other handles. Child process (tries) to write whole message at once and does not do heavy job in between. It's also a pipe, i.e. on localhost.
    Even if there is 100 children, and they do actual heavy job, and send 100-bytes message to master once a second, it's just 100 messages perl second.
    That approach of course, is not good when you're writing thing like http proxy (like nginx) with slow clients, when multiplexing between clients directly affects performance.
    So for things like http proxies (like nginx) there should be more complicated solution.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1173832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2019-12-07 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (162 votes). Check out past polls.

    Notices?