[Ndn-interest] Send multiple Interests in parallel

Davide Pesavento davidepesa at gmail.com
Mon Mar 15 14:26:31 PDT 2021


Hi Raphaël,

How are you "receiving" these requests from the app layer? I assume
your app is already asynchronous? In that case you basically have two
options: 1) integrate the app's event loop with Boost.Asio's event
loop (io_service/io_context), I don't have any concrete suggestions
but this isn't a problem specific to ndn-cxx; 2) run the ndn-cxx/Asio
event loop in a separate thread and perform all the Face-related
operations in that thread (it's your responsibility to properly
synchronize the threads to prevent data races).

Davide

On Wed, Mar 10, 2021 at 4:36 AM NAVES Raphael
<raphael.naves at thalesgroup.com> wrote:
>
> Hi Davide,
>
> Thanks for your answer. Indeed I am using ndn-cxx.
>
> I have considered using the ndn::Scheduler class. However, it is not really adapted to my usecase since I am receiving on-the-fly from an application layer the requests for sending the Interests and then I cannot really schedule them in advance.
>
> The workaround that I have found is to use the processEvent() function, with as "timeout" parameter a very low value (1 ms). With this, I am not blocked for a long time in the function and including it in a "while" loop, I can send an Interest every millisecond if I need it. What do you think of this approach? I admit that the role of the processEvent()  function is not very clear to me. What are the consequences of using it with a non-zero timeout?
>
> Best
>
> Raphaël
>
> -----Message d'origine-----
> De : Davide Pesavento <davidepesa at gmail.com>
> Envoyé : mercredi 10 mars 2021 01:52
> À : NAVES Raphael <raphael.naves at thalesgroup.com>
> Cc : ndn-interest at lists.cs.ucla.edu
> Objet : Re: [Ndn-interest] Send multiple Interests in parallel
>
> Hi Raphaël,
>
> I'm assuming you're using ndn-cxx, since you mention the processEvents function?
>
> In ndn-cxx, processEvents() is used to "enter" the event processing loop, any number of events/callbacks may be outstanding when the event loop is entered. In other words, you can express several interests before calling processEvents(). You can also use the ndn::Scheduler class to schedule the execution of a function at a future point in time.
>
> Lastly, please note that blindly sending hundreds of interests per second without proper congestion control may overwhelm the network and/or the receiver(s).
>
> Best,
> Davide
>
> On Tue, Mar 9, 2021 at 10:08 AM NAVES Raphael via Ndn-interest <ndn-interest at lists.cs.ucla.edu> wrote:
> >
> > Hello everyone,
> >
> >
> >
> > I would like to create a consumer that sends multiple Interests (for different data) in parallel (approximatively 400 interests per second). When I say “parallel”, that means that my consummer does not want to wait for the answer of the previous Interest to send the next one. My problem is that the “processEvents” function used in most consumer examples is a blocking function (it waits for the data, NACK or timeout). What I did is that I instantiate a new thread for each Interest sending. But I get some problems of resource allocations because it seems that the created threads are not freed. I am pretty sure that there is a more proper way to do this, but I don’t get it.
> >
> >
> >
> > Can someone help me ?
> >
> >
> >
> > Thanks in advance
> >
> >
> >
> > Raphaël
> >
> >
> >
> >
> >
> > _______________________________________________
> > Ndn-interest mailing list
> > Ndn-interest at lists.cs.ucla.edu
> > http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest


More information about the Ndn-interest mailing list