tests/stress/client/stress_experiment.py
def main():
    """Run all stress tests and render the plot"""
    size = 500

    num_workers = [1, 4, 16, 32, 64, 128]

    fig, axis = plt.subplots(
        len(num_workers),
        1,
        figsize=(5, 1.8 * len(num_workers)),
        gridspec_kw={"hspace": 0.01, "wspace": 0},
        sharex="col",
    )

    results = {}

    for i, workers in enumerate(num_workers):

        results[workers] = benchmark(workers, size)

        for backend in ["mongodb", "pickleddb"]:
            for space_type in ["discrete", "real", "real-seeded"]:
                x, y = results[workers][(backend, space_type)]
                axis[i].plot(x, y, label=f"{backend}-{space_type}")

    for i, workers in enumerate(num_workers):
        # We pick 'pickleddb' and discrete=True as the reference for the slowest ones
        x, y = results[min(num_workers)][("pickleddb", "discrete")]
        d_x = max(x) - min(x)
        d_y = max(y) - min(y)
        if i < len(num_workers) - 1:
            axis[i].text(
                min(x) + d_x * 0.6, min(y) + d_y * 0.1, f"{workers: 3d} workers"
            )
        else:
            axis[i].text(
                min(x) + d_x * 0.6, min(y) + d_y * 0.7, f"{workers: 3d} workers"
            )

    for i in range(len(num_workers) - 1):
        axis[i].spines["top"].set_visible(False)
        axis[i].spines["right"].set_visible(False)

    axis[-1].spines["right"].set_visible(False)
    axis[-1].spines["top"].set_visible(False)

    axis[-1].set_xlabel("Time (s)")
    axis[-1].set_ylabel("Number of trials")
    axis[-1].legend()

    plt.subplots_adjust(left=0.15, bottom=0.05, top=1, right=1)

    plt.savefig("test.png")
Run all stress tests and render the plot
Run all stress tests and render the plot
Run all stress tests and render the plot
def main():
    size = 500
    num_workers = [1, 4, 16, 32, 64, 128]
    fig, axis = plt.subplots(
        len(num_workers),
        1,
        figsize=(5, 1.8 * len(num_workers)),
        gridspec_kw={"hspace": 0.01, "wspace": 0},
        sharex="col",
    )
    results = {}
    for i, workers in enumerate(num_workers):
        results[workers] = benchmark(workers, size)
        for backend in ["mongodb", "pickleddb"]:
            for space_type in ["discrete", "real", "real-seeded"]:
                x, y = results[workers][(backend, space_type)]
                axis[i].plot(x, y, label=f"{backend}-{space_type}")
    for i, workers in enumerate(num_workers):
        x, y = results[min(num_workers)][("pickleddb", "discrete")]
        d_x = max(x) - min(x)
        d_y = max(y) - min(y)
        if i < len(num_workers) - 1:
            axis[i].text(
                min(x) + d_x * 0.6, min(y) + d_y * 0.1, f"{workers: 3d} workers"
            )
        else:
            axis[i].text(
                min(x) + d_x * 0.6, min(y) + d_y * 0.7, f"{workers: 3d} workers"
            )
    for i in range(len(num_workers) - 1):
        axis[i].spines["top"].set_visible(False)
        axis[i].spines["right"].set_visible(False)
    axis[-1].spines["right"].set_visible(False)
    axis[-1].spines["top"].set_visible(False)
    axis[-1].set_xlabel("Time (s)")
    axis[-1].set_ylabel("Number of trials")
    axis[-1].legend()
    plt.subplots_adjust(left=0.15, bottom=0.05, top=1, right=1)
    plt.savefig("test.png")
def main ( ) : size = 500 num_workers = [ 1 , 4 , 16 , 32 , 64 , 128 ] fig , axis = plt . subplots ( len ( num_workers ) , 1 , figsize = ( 5 , 1.8 * len ( num_workers ) ) , gridspec_kw = { "hspace" : 0.01 , "wspace" : 0 } , sharex = "col" , ) results = { } for i , workers in enumerate ( num_workers ) : results [ workers ] = benchmark ( workers , size ) for backend in [ "mongodb" , "pickleddb" ] : for space_type in [ "discrete" , "real" , "real-seeded" ] : x , y = results [ workers ] [ ( backend , space_type ) ] axis [ i ] . plot ( x , y , label = f"{backend}-{space_type}" ) for i , workers in enumerate ( num_workers ) : x , y = results [ min ( num_workers ) ] [ ( "pickleddb" , "discrete" ) ] d_x = max ( x ) - min ( x ) d_y = max ( y ) - min ( y ) if i < len ( num_workers ) - 1 : axis [ i ] . text ( min ( x ) + d_x * 0.6 , min ( y ) + d_y * 0.1 , f"{workers: 3d} workers" ) else : axis [ i ] . text ( min ( x ) + d_x * 0.6 , min ( y ) + d_y * 0.7 , f"{workers: 3d} workers" ) for i in range ( len ( num_workers ) - 1 ) : axis [ i ] . spines [ "top" ] . set_visible ( False ) axis [ i ] . spines [ "right" ] . set_visible ( False ) axis [ - 1 ] . spines [ "right" ] . set_visible ( False ) axis [ - 1 ] . spines [ "top" ] . set_visible ( False ) axis [ - 1 ] . set_xlabel ( "Time (s)" ) axis [ - 1 ] . set_ylabel ( "Number of trials" ) axis [ - 1 ] . legend ( ) plt . subplots_adjust ( left = 0.15 , bottom = 0.05 , top = 1 , right = 1 ) plt . savefig ( "test.png" )
Run all stress tests and render the plot
Run all stress tests and render the plot
"""Run all stress tests and render the plot""" # We pick 'pickleddb' and discrete=True as the reference for the slowest ones