Open AqsaKashaf opened 2 years ago
Hello @AqsaKashaf, did you manage to do this; I am starting to use click again after a long time and I am trying to figure out how can I do the same thing.
element class Pipeline { $thread |
input[0]
-> Stuff
-> uq :: Unqueue
-> [0]output;
StaticThreadSched(uq $thread);
}
inq :: ThreadSafeQueue;
outq :: ThreadSafeQueue;
inq -> p0 :: Pipeline(0) -> outq;
inq -> p1 :: Pipeline(1) -> outq;
THis solution duplicates the processing pipeline because nearly no processing elements in "normal" Click is thread-safe, but you can have :
inq-> Stuff -> Stuff2 -> f :: Stuff3;
f -> p0;
f -> p1;
In that case Stuff and Stuff2 will be traversed by multiple threads which is fine for state-less elements.
My own thought : pipelining is a thing of the past when CPU had 4 cores... In no ways it scales with many-cores CPUs and high-speed links where a single core cannot act as the RX or TX core anyway. Use sharding instead, properly supported in FastClick. Or in Click duplicating the pipeline N times and handling manually the state reconcilation.
Hi, I want to write a module which looks something like: in :: FromDevice(eth1) q :: Queue uq :: Unqueue
// do some processing here out :: ToDevice(eth2) in -> q -> uq -> processing here -> out
However, I want to do this in a mult-threaded way, assuming I have multiple processing threads. A packet comes on eth1, it is queued. Then I want it to be dequeued by whichever thread is currently not busy and so on. And then finally all threads push the packets out to eth2. I came across ThreadSafeQueue but I am not sure about the Unqueue part.