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

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!" ~ e.to!string ~ "(options)"));
                    break;
                }
            }
        }
    }
    pool.finish();

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?

Reply via email to