26

Re: Multi-threaded reading on UDP

Pzz> It is internal problems of OS. recvfrom () from  a socket does one or the other: or finds one whole datagram, or returns an error. The datagram never fights between two serial recvfrom () is readable on a subject, or reads as much as possible given size which to it told and that in your case it returns an error that in a root truly generally anything it is necessary to explain to me, I with a kernel on you

27

Re: Multi-threaded reading on UDP

Hello, Nikolay_Ch, you wrote: N_C> Hello, reversecode, you wrote: R>>  the safe yet does not mean that two flows can cause recvfrom and at once receive under datagram N_C> Thread safety does not guarantee presence of the data... It as though from a different opera of a thing... I spoke about that that if one flow entered in recvfrom the second can sit and wait while the first quits in such context generally sense is not present on flows to scatter R>> I about IOCP instead of about covered posix on top N_C> And library SOCKETS works at level POSIX and the author did not specify what sockets it uses)) in Windows there are they and IOCP

28

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: Pzz>> It is internal problems of OS. recvfrom () from  a socket does one or the other: or finds one whole datagram, or returns an error. The datagram never fights between two serial recvfrom () R> is readable on a subject, or reads as much as possible given size which to it told This phrase it is impossible to understand recvfrom never beats the datagram between two calls. Was specific for UDP and  and unix how much I remember, if the buffer too small, silently cut off the datagram. For other types  sockets can instead of it and an error to return. But on two read' the datagram do not cut. R> and that in your case it returns an error that in a root truly R> generally anything it is necessary to explain to me, I with a kernel on you Well, the good fellow.

29

Re: Multi-threaded reading on UDP

Hello, Nikolay_Ch, you wrote: N_C> Hello, reversecode, you wrote: R>> in  they not iocp R>> and in Windows posix lies on top iocp as far as I know, i.e.  N_C> And what difference? recvfrom where where, and on Windows precisely works how I wrote. Well? And I told about that that there are still sockets IOCP the author he did not specify what uses, and I in the first answer hinted that if  but not posix - that all can be on another R>> the author did not specify what wasps and what functions R>> but with IOCP there are thoughts that all will work on another, well i.e. there the Windows on flows scatters all N_C> recvfrom are POSIX like as... By itself R>> generally still in  is recvmsg so can eat sense with them to be played for catching  buffer counts N_C> What buffers, excuse? There is an entering buffer of a socket and there datagrams are added. Them not one, not two and much. . The user buffer if recvmsg allows to take away at once on 5 , it is better than two flows will push in one recvfrom on one socket

30

Re: Multi-threaded reading on UDP

On two does not beat, for a long time already understood but to read less than it was accepted in a socket - it is possible, remaining it will be discarded for ever (if to trust Google)

31

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> I in buffers am not confused, it you were tangled about what buffers I each time I speak from the very beginning said about that or is copied in the buffer recvfrom or is discarded. You  any mbuf and other... And when you came into Google read about that I told again did not understand, about what buffer there is a speech... R> in a context  buffers, I meant already unpacking of the data of the datagram for preparation in the buffer whence already given leave the user I shifted to the Left to you already specified that at each level the ... And at each level the rules. And from the very beginning I spoke about rules of operation of function recvfrom R> clearly that if there was no storages or an error on  or  level that to the user that that that to tell sense was not present, all in the silent is wetted Here only to a question of the author of a subject it does not concern from a word absolutely

32

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> it is readable on a subject, or reads as much as possible given size which to it told R> and that in your case it returns an error that in a root not truly Is not present, not in a root... It copies that is possible and nevertheless returns an error. R> generally anything it is not necessary to explain to me, I with a kernel on you But with upper API Sockets you not so understand, excuse.

33

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> on two does not beat, for a long time already understood R> but to read less than it was accepted in a socket - it is possible, remaining Ugu will be discarded for ever (if to trust Google).

34

Re: Multi-threaded reading on UDP

Hello, Nikolay_Ch, you wrote: N_C> Hello, reversecode, you wrote: R>> I in buffers am not confused, it you were tangled about what buffers I each time I speak N_C> from the very beginning said about that or is copied in the buffer recvfrom or is discarded. You  any mbuf and other... N_C> And when you came into Google read about that I told again did not understand, about what buffer there is a speech... Your words it looks as if the buffer in which we read will be less - that will be discarded that already forced to doubt is not discarded, and read in size with the buffer, and the remaining part is discarded about mbuf there were simply subject development in which you started to pull))

35

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> and the author did not specify what sockets it uses)) in Windows there are they and IOCP function recvfrom concerns to POSIX...

36

Re: Multi-threaded reading on UDP

Hello, Nikolay_Ch, you wrote: N_C> Hello, reversecode, you wrote: R>> and the author did not specify what sockets it uses)) in Windows there are they and IOCP N_C> function recvfrom concerns to POSIX... I also did not deny that it not posix tell as from a forum it will be deleted with a content is better, already a floor of year I ask moderators and they do not release me

37

Re: Multi-threaded reading on UDP

Hello, reversecode, you wrote: R> if recvmsg allows to take away at once on 5 , it is better than two flows will push in one recvfrom on one socket you with "parallel" algorithms of data handling are familiar? To take away 5 at once and then them by turns  it will be not always better, than to make in one flow a fence under one datagram and to launch so much flows, how many it is necessary for speed. Why you consider, what the flow only does, what takes away datagrams? It still should process them. Here, while it processes it is possible to read also other flow.

38

Re: Multi-threaded reading on UDP

Such stupidity can be only from for the bad design therefore I counted the second variant, the author wants to obtain the data from a socket faster

39

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: DTF> Colleagues, greetings. Whether DTF> prompt, please, it is possible to read from several flows the data from the same UDP-socket? It is possible, will work safely. But not so quickly, as locks in a kernel will eat time. In Linux more correctly in each flow to create the socket with SO_REUSEPORT and to hang up them on the same port. A kernel addressee/sender/port will try to send flows of packets in the determined sockets depending on triple: https://lwn.net/Articles/542629/

40

Re: Multi-threaded reading on UDP

Hello, DTF, you wrote: DTF> Colleagues, greetings. Whether DTF> prompt, please, it is possible to read from several flows the data from the same UDP-socket? Whether DTF> the data will be lost and-or damaged? DTF> and what documentation it is possible to esteem on this subject? DTF> I could  that recv/recvfrom are , i.e. they can be caused simultaneously. DTF> but what will be dataful which they read? Whether DTF> will be so, what one piece of the datagram leaves in one flow, and other piece - in other flow? It is possible, but it is silly. It is better to read in one and to arrange on flows as it is necessary. Or to create some sockets on one port and to receive on everyone on a datagram copy, it is possible even in different processes. Here only what for all it? Against speed of data acquisition never rested nothing, is faster in transit velocity.

41

Re: Multi-threaded reading on UDP

T> Here only what for all it? Against speed of data acquisition never rested nothing, is faster in transit velocity. Here  such sights also there are then such subjects the Author: vsb Date: 29.04 23:38.

42

Re: Multi-threaded reading on UDP

Hello, Teolog, you wrote: T> It is possible, but it is silly. It is better to read in one and to arrange on flows as it is necessary. No, not silly. On 10 will be more than one million the packets per second, one flow does not consult. Simply dies on switchings of contexts. Further, network cards during the present moment have some hardware queues. In case of several listening sockets in different flows/processes all turns out simply - queues uniformly to be arranged in between. In fastpath' in a kernel there now even there are no global locks.

43

Re: Multi-threaded reading on UDP

Hello, Cyberax, you wrote: the C> Simply dies on switchings of contexts. What, system calls?

44

Re: Multi-threaded reading on UDP

Hello, Sharov, you wrote: the C>> Simply dies on switchings of contexts. S> what, system calls? Their most. Everyone recvfrom - switching in a kernel and is reverse. Then still data retrieveds should be scattered on flows-output agents - still synchronization.

45

Re: Multi-threaded reading on UDP

Hello, Cyberax, you wrote: a C> Hello, Sharov, you wrote: the C>>> Simply dies on switchings of contexts. S>> what, system calls? A C> Their most. Everyone recvfrom - switching in a kernel and is reverse. Then still data retrieveds should be scattered on flows-output agents - still synchronization. -lock-free queue, a zero of synchronization and context switchings. It is possible to balance an amount of processing flows on queue length up to from zero to N. Certainly, if it is not supposed to saw on a knee a brutal dredge of the data for date-center that would be extremely  can spit and transfer the data to all this bosh through  and std:queue with critical section one worker thread.

46

Re: Multi-threaded reading on UDP

Hello, Teolog, you wrote: a C>> Their most. Everyone recvfrom - switching in a kernel and is reverse. Then still data retrieveds should be scattered on flows-output agents - still synchronization. T> Peredacha-lock-free queue, a zero of synchronization and context switchings. It is possible to balance an amount of processing flows on queue length up to from zero to N. Lock-free demands atomic operations, which absolutely . Besides, they can work as places more slowly normal locks if is competitive chtenija/zapis. Methods of struggle against it are (see: disruptor), but they add still complexity ton. T> it is finite, if it is not supposed to saw on a knee a brutal dredge of the data for date-center that would be extremely  can spit and transfer the data to all this bosh through  and std:queue with critical section one worker thread. It would be so if some listening sockets demand  the code of 80th level of complexity. But in this case such code will be easier than the code with the separate flow scattering the messages.

47

Re: Multi-threaded reading on UDP

Hello, Cyberax, you wrote: the C> Lock-free demands atomic operations, which absolutely . Besides, they can work as places more slowly normal locks if is competitive chtenija/zapis. Dearness at iron level - cache coherence etc. And so, quite to itself a method.