Fiber based HTTP client for load testing

Arun aruncxy at
Thu Oct 1 00:35:49 UTC 2020

I have a REST client that can do load test of my REST services. 
It uses ikod's dlang-requests under the hood.

At the moment I use a thread pool to dispatch the runtime 
operation and send the requests to the server.

     /// Iterates over the enum members and builds a switch case 
statement at compile time.
     /// If the input operation matches the case, the runtime 
dispatches the corresponding
     /// task pool with it's options.
     auto pool = new TaskPool(options.threadCount);
     foreach (_; 0 .. options.threadCount) {
         foreach (__; 0 .. options.iterationCount) {
             final switch (options.operation) {
                 foreach (e; EnumMembers!Operation) {
             case e:
                     pool.put(mixin("task!" ~!string ~ 

As seen, the downside is that the more threads we use the more 
memory the app consumes. Is there a way to replace the threads 
with fibers in this particular case so that instead of spawning 
1000 threads, we spawn 1000 fibers with just 1 thread?

More information about the Digitalmars-d-learn mailing list