示例#1
0
def create_all_histograms():

    create_datadir_if_not_exists(GRAPHPATH)

    keysize = "6"
    shardings = [False, True]

    _number_shardings = len(shardings)

    middleware_latencies = np.zeros(
        (_number_shardings, 2,
         3))  # the "two" is for the number of middlewares
    client_latencies = np.zeros(
        (_number_shardings, 2, 3, 3)
    )  # the "two" and "three" is for middlewares and clients respectively

    # Iterate through keysizes
    for jdx, sharding in enumerate(shardings):
        print("Sharding: ", sharding)

        print("Keysize is: ", keysize)

        # ONCE FOR THE MIDDLEWARE
        for repetition in range(3):

            for middleware in [1, 2]:
                # Get throughput and latency from the file
                middleware_filename = get_pattern_exp5_1_middleware(
                    middleware=middleware,
                    keysize=keysize,
                    repetition=repetition,
                    sharding=sharding)

                try:
                    df = parse_log(BASEPATH + middleware_filename)
                    tmp_latencies_mw = get_histogram_latency_log_dataframe_middleware(
                        df).T
                    # print("ATT")
                    # print(jdx, idx, middleware, repetition)
                    # print(type(jdx), type(idx), type(middleware), type(repetition))
                    middleware_latencies[
                        jdx, idx, :, middleware - 1,
                        repetition] = get_avg_25_50_75_90_99_percentiles(
                            tmp_latencies_mw)

                except Exception as e:
                    # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                    print("WRONG WITH THE FOLLOWING CONFIG: ",
                          middleware_filename)
                    print(e)
                    continue

            # ONCE FOR THE CLIENT
            for client_idx, client in enumerate(
                ['Client1', 'Client2', 'Client3']):

                for middleware in [1, 2]:

                    # TODO: Do it for each individual middleware!
                    # Trying to open and read the file!
                    client_filename = get_pattern_exp5_1_client(
                        keysize=keysize,
                        middleware=middleware,
                        repetition=repetition,
                        client=client,
                        sharding=sharding)

                    try:
                        _, tmp_latencies_client_get = read_client_histogram_as_dataframe(
                            filepath=BASEPATH + client_filename)
                        # print("At")
                        # print(jdx, idx, middleware, client_idx, repetition)
                        # print(type(jdx), type(idx), type(middleware), type(client_idx), type(repetition))
                        set_df, get_df = read_client_histogram_as_dataframe(
                            tmp_latencies_client_get)
                        # print("Indecies: ", jdx, idx, :, middleware - 1, client_idx, repetition)
                        if np.isnan(out).any():
                            print("Out is: ", out)
                            client_latencies[
                                jdx, idx, :, middleware - 1, client_idx,
                                repetition] = client_latencies[jdx, idx, :,
                                                               middleware - 1,
                                                               client_idx, 0]
                        else:
                            client_latencies[jdx, idx, :, middleware - 1,
                                             client_idx, repetition] = out

                    except Exception as e:
                        # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                        print("WRONG WITH THE FOLLOWING CONFIG: ",
                              middleware_filename)
                        print(e)
                        assert False
                        continue

        # Normalizing the graphs to the appropriate shapes by taking means (and calculating stddevs)
        mean_client_latencies = np.mean(client_latencies,
                                        axis=1,
                                        keepdims=True)
        mean_client_latencies = np.mean(mean_client_latencies,
                                        axis=2,
                                        keepdims=True)

        mean_middleware_latencies = np.mean(middleware_latencies,
                                            axis=1,
                                            keepdims=True)

        mean_client_latencies = mean_client_latencies.squeeze()
        mean_middleware_latencies = mean_middleware_latencies.squeeze()

        print("Squeezed")
        print(mean_client_latencies.shape)
        print(mean_middleware_latencies.shape)

        client_means = np.mean(mean_client_latencies[jdx, :, :, :], axis=2)
        client_stddevs = np.std(mean_client_latencies[jdx, :, :, :], axis=2)

        mw_means = np.mean(mean_middleware_latencies[jdx, :, :, :], axis=2)
        mw_stddev = np.std(mean_middleware_latencies[jdx, :, :, :], axis=2)

        print(mw_means)
        print(client_means)

        print("Means and Stddev")
        print(client_means.shape)
        print(client_stddevs.shape)
        print(mw_means.shape)
        print(mw_stddev.shape)

        create_multiple_histogram_plot(
            keys=multikeys,
            means=client_means,
            stddevs=client_stddevs,
            filepath=GRAPHPATH +
            "exp5_1_client_percentile_plots_sharded_{}".format(sharding))

        create_multiple_histogram_plot(
            keys=multikeys,
            means=mw_means,
            stddevs=mw_stddev,
            filepath=GRAPHPATH +
            "exp5_1_mw_percentile_plots_sharded_{}".format(sharding))
示例#2
0
def iterate_through_experiments_exp3_2():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)

    middleware_threads = [(2 ** x) for x in range(3, 7)]
    virtual_clients = [(2 ** x) for x in range(0, 6)]


    total_virtual_clients = len([(2 ** x) for x in range(0, 6)])
    total_middleware_threads = len([(2 ** x) for x in range(3, 7)])

    for write in [0, 1]:

        max_throughput = 0
        max_throughput_client = 0

        mw_throughput_means = np.zeros((total_virtual_clients, total_middleware_threads))
        mw_throughput_stddev = np.zeros((total_virtual_clients, total_middleware_threads))
        mw_latency_means = np.zeros((total_virtual_clients, total_middleware_threads))
        mw_latency_stddev = np.zeros((total_virtual_clients, total_middleware_threads))

        client_throughput_means = np.zeros((total_virtual_clients, total_middleware_threads))
        client_latency_means = np.zeros((total_virtual_clients, total_middleware_threads))
        client_throughput_stddev = np.zeros((total_virtual_clients, total_middleware_threads))
        client_latency_stddev = np.zeros((total_virtual_clients, total_middleware_threads))


        for _vc in range(0, 6):
            vc = (2 ** _vc)

            for _mt in range(3 - 3, 7 - 3):
                mt = (2 ** (_mt + 3))

                client_all_throughputs = []  # From here on, we average over all values
                client_all_latencies = []

                mw_all_throughputs = []
                mw_all_latencies = []

                queuetimes = []

                for repetition in range(3):

                    for middleware in [1, 2]:

                        # Get throughput and latency from the file
                        middleware_filename = get_pattern_exp3_2_middleware(
                            virtualclientthreads=vc,
                            middlewarethreads=mt,
                            repetition=repetition,
                            write=write,
                            middleware=middleware
                        )

                        try:
                            df = parse_log(BASEPATH + middleware_filename)
                            mw_throughput, mw_latency = get_latency_log_dataframe(df)
                            queuetimes.append(df['differenceTimeEnqueuedAndDequeued'].astype(float).mean())

                            mw_throughput *= mt * 1000 # because we have two middlewares # * (2./3.) # because the load of the clients is distributed on two middlewares

                            print("Throughput is: ", mw_throughput)

                            mw_all_throughputs.append(mw_throughput)
                            mw_all_latencies.append(mw_latency)

                        except Exception as e:
                            print("WRONG WITH THE FOLLOWING CONFIG: ", middleware_filename)
                            print(e)
                            continue

                    for client in ['Client1', 'Client2', 'Client3']:
                        for middleware in [1, 2]:

                            client_filename = get_pattern_exp3_2_client(
                                virtual_client_threads=vc,
                                middlewareworkerthreads=mt,
                                repetition=repetition,
                                client=client,
                                write=write,
                                middleware=middleware
                            )

                            # Trying to open and read the file!

                            try:
                                client_throughput, client_latency = get_throughput_latency_default_memtier(filepath=BASEPATH + client_filename)
                                client_all_throughputs.append(client_throughput)
                                client_all_latencies.append(client_latency)

                            except Exception as e:
                                print("WRONG WITH THE FOLLOWING CONFIG: ", middleware_filename)
                                print(e)
                                continue

                print("VC and MT ", (mt, vc))
                print("NEW VC and MT ", (_mt, _vc))

                mw_mean_latency = np.mean(mw_all_latencies)
                mw_mean_throughput = np.sum(mw_all_throughputs) / 3. # because we have 3 repeats, and two middlewares (throughput per middleware is calculated as the total throughput)
                mw_stddev_latency = np.std(mw_all_latencies)
                mw_stddev_throughput = np.std(mw_all_throughputs)

                if max_throughput < mw_mean_throughput:
                    max_throughput = mw_mean_throughput
                    print("TTT", write, mw_mean_throughput, mw_mean_latency, np.mean(queuetimes))

                # Append to list
                mw_throughput_means[_vc, _mt] = mw_mean_throughput
                mw_latency_means[_vc, _mt] = mw_mean_latency
                mw_throughput_stddev[_vc, _mt] = mw_stddev_throughput
                mw_latency_stddev[_vc, _mt] = mw_stddev_latency

                client_mean_latency = np.mean(client_all_latencies)
                client_mean_throughput = np.sum(client_all_throughputs) / 3.
                client_stddev_latency = np.std(client_all_latencies)
                client_stddev_throughput = np.std(client_all_throughputs)


                if max_throughput_client < client_mean_throughput:
                    max_throughput_client = client_mean_throughput
                    print("TTT CLIENT", write, client_mean_throughput, client_mean_latency)

                    # TTT 0 2978.673972968874 14.885140067475584 588816.9135975742
                    # TTT CLIENT 0 3010.066666666667 15.961666666666666

                # Append to list
                client_throughput_means[_vc, _mt] = client_mean_throughput
                client_latency_means[_vc, _mt] = client_mean_latency
                client_throughput_stddev[_vc, _mt] = client_stddev_throughput
                client_latency_stddev[_vc, _mt] = client_stddev_latency

            print(client_throughput_means[:,_mt].flatten())
            print(total_virtual_clients)

            # Assertions
            len_mt = client_throughput_means[:, _mt].flatten().shape
            len_vc = client_throughput_means[:, _mt].flatten().shape
            len1 = virtual_clients

            print("All lengths are : ")
            print(len_mt)
            print(len_vc)
            print(len1)


        # THROUGHPUTS
        print("###write:client ", write, client_throughput_means)
        print("###write:middleware ", write, mw_throughput_means)
        ###write:client  0
        # [[ 1920.88        1918.63333333  1879.97666667  2040.63666667]
        # [2948.59        2948.03        2953.48666667  4106.08333333]
        # [2984.82333333  2906.10666667  2994.25        7329.56]
        # [2968.63666667  2931.46333333  4117.91        9388.87666667]
        # [2948.98        2924.93       10709.36       10652.36333333]
        # [2967.09333333  2988.49       11116.91333333 10953.04]]
        ###write:middleware  0
        # [[ 1823.82088122  1831.66427863  1788.32232092  1963.94693059]
        # [2894.0011844   2893.19407003  2889.4399206   3919.63102998]
        # [2904.84043756 2916.86120553 2914.29668445 6350.16067147]
        # [2919.44080752  2923.44783548  2898.39238625  8313.77410761]
        # [2916.26533345 2912.31134097 9796.16787827 9657.16189206]
        # [2923.77401065  2917.48683475 10330.97247506  9984.91367675]]

        ###write:client  1
        # [[1371.69       1433.82666667 1428.60333333 1474.68333333]
        # [2243.24333333 2678.12       2598.63       2644.23]
        # [3439.77333333 4868.33       4909.14       3774.43333333]
        # [5648.88333333 5682.95333333 6149.03       6716.31666667]
        # [5882.05       7103.95333333 6660.81333333 8108.17]
        # [5883.05333333 6663.61333333 6983.25666667 4487.62]]
        ###write:middleware  1 [[1401.75925962 1472.40508414 1479.24123472 1517.59234247]
        # [2784.22311061 2977.37234977 2626.56406027 2976.11177963]
        # [5079.75686936 5304.33947114 4915.28801361 4549.81135794]
        # [6597.81205289 6870.64256402 6942.7881017  6715.72352865]
        # [6539.19650736 7693.89813362 8053.29642461 8131.41925129]
        # [6670.31737933 7462.38036606 7429.34669134 7160.16151776]]

        # LATENCIES
        print("###write:client ", write, client_latency_means)
        print("###write:middleware ", write, mw_latency_means)

        ###write:client  0
        # [[ 1.57666667  1.58        1.61333333  1.49777778]
        # [2.05555556 2.06222222 2.05777778 1.48888889]
        # [4.05666667  4.17        4.03777778  1.65222222]
        # [8.10111111 8.21222222 6.61666667 2.57333333]
        # [16.22222222 16.40888889  4.49777778  4.53666667]
        # [32.37111111 32.09222222 8.65888889 8.78444444]]
        ###write:middleware  0 [[ 0.75373062  0.71682754  0.79261609  0.68196475]
        # [1.14245532  1.15601874  1.12761835  0.6962914]
        # [3.00268178 3.06263071 3.08864053 0.82161966]
        # [7.07679403  6.89052932  6.98758393  1.18371943]
        # [15.26808786 15.11082288 1.48361568 1.50505344]
        # [31.39592934 31.16684201  1.71758052  1.96693429]]

        ###write:client  1 [[ 2.18222222  2.08888889  2.09666667  2.03111111]
        # [1.83222222  1.97444444  1.83111111  2.00444444]
        # [2.02111111  2.17222222  1.92888889  1.63666667]
        # [3.78        2.89777778  2.76444444  2.87222222]
        # [7.29444444  5.97222222  5.64333333  3.69111111]
        # [12.14444444 10.79       10.41555556 14.27666667]]
        ###write:middleware  1
        # [[ 1.14301648  1.03218857  1.02287563  0.98682917]
        # [1.02473659  1.01945742  1.08312422  1.00336116]
        # [1.09529057 1.12426547 1.15199756 1.10026307]
        # [2.38971881  1.71178708  1.66788647  1.66212348]
        # [5.65331611 3.1920922 2.80038391 2.75255764]
        # [11.12888022  4.42134564  2.9218675   2.73590902]]

        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=client_throughput_means.T,
            stddev_array=client_throughput_stddev.T,
            filepath=GRAPHPATH + "exp3_2__throughput_client_write_{}".format(write),
            is_latency=False
        )
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=client_latency_means.T,
            stddev_array=client_latency_stddev.T,
            filepath=GRAPHPATH + "exp3_2__latency_client_write_{}".format(write),
            is_latency=True
        )

        # Plot the middleware values
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=mw_throughput_means.T,
            stddev_array=mw_throughput_stddev.T,
            filepath=GRAPHPATH + "exp3_2__throughput_middleware_write_{}".format(write),
            is_latency=False
        )
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=mw_latency_means.T,
            stddev_array=mw_latency_stddev.T,
            filepath=GRAPHPATH + "exp3_2__latency_middleware_write_{}".format(write),
            is_latency=True
        )
示例#3
0
def iterate_through_experiments_exp3_1():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)

    middleware_threads = [(2**x) for x in range(3, 7)]
    virtual_clients = [(2**x) for x in range(0, 6)]

    total_virtual_clients = len([(2**x) for x in range(0, 6)])
    total_middleware_threads = len([(2**x) for x in range(3, 7)])

    for write in [0, 1]:

        max_throughput = 0
        max_throughput_client = 0

        mw_throughput_means = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        mw_throughput_stddev = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        mw_latency_means = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        mw_latency_stddev = np.zeros(
            (total_virtual_clients, total_middleware_threads))

        client_throughput_means = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        client_latency_means = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        client_throughput_stddev = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        client_latency_stddev = np.zeros(
            (total_virtual_clients, total_middleware_threads))

        for _vc in range(0, 6):
            vc = (2**_vc)

            for _mt in range(3 - 3, 7 - 3):
                mt = (2**(_mt + 3))

                client_all_throughputs = [
                ]  # From here on, we average over all values
                client_all_latencies = []

                mw_all_throughputs = []
                mw_all_latencies = []

                queuetimes = []

                for repetition in range(3):

                    # Get throughput and latency from the file
                    middleware_filename = get_pattern_exp3_1_middleware(
                        virtualclientthreads=vc,
                        middlewarethreads=mt,
                        repetition=repetition,
                        write=write,
                    )

                    try:
                        df = parse_log(BASEPATH + middleware_filename)
                        mw_throughput, mw_latency = get_latency_log_dataframe(
                            df)
                        mw_throughput *= mt * 1000  # bcs this gives us overall throughput per millisecond, and not per thread anymore

                        queuetimes.append(
                            df['differenceTimeEnqueuedAndDequeued'].astype(
                                float).mean())

                        mw_all_throughputs.append(mw_throughput)
                        mw_all_latencies.append(mw_latency)

                    except Exception as e:
                        print("WRONG WITH THE FOLLOWING CONFIG: ",
                              middleware_filename)
                        print(e)
                        continue

                    for client in ['Client1', 'Client2', 'Client3']:

                        client_filename = get_pattern_exp3_1_client(
                            virtual_client_threads=vc,
                            middlewareworkerthreads=mt,
                            repetition=repetition,
                            client=client,
                            write=write)

                        # Trying to open and read the file!

                        try:
                            client_throughput, client_latency = get_throughput_latency_default_memtier(
                                filepath=BASEPATH + client_filename)
                            client_all_throughputs.append(client_throughput)
                            client_all_latencies.append(client_latency)

                            print("Client: ", client_throughput,
                                  client_latency)

                        except Exception as e:
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue
                print("VC and MT ", (mt, vc))
                print("NEW VC and MT ", (_mt, _vc))

                mw_mean_latency = np.mean(mw_all_latencies)
                mw_mean_throughput = np.sum(mw_all_throughputs) / 3.
                mw_stddev_latency = np.std(mw_all_latencies)
                mw_stddev_throughput = np.std(mw_all_throughputs)

                if max_throughput < mw_mean_throughput:
                    max_throughput = mw_mean_throughput
                    print("TTT", write, mw_mean_throughput, mw_mean_latency,
                          np.mean(queuetimes))

                # Append to list
                mw_throughput_means[_vc, _mt] = mw_mean_throughput
                mw_latency_means[_vc, _mt] = mw_mean_latency
                mw_throughput_stddev[_vc, _mt] = mw_stddev_throughput
                mw_latency_stddev[_vc, _mt] = mw_stddev_latency

                client_mean_latency = np.mean(client_all_latencies)
                client_mean_throughput = np.sum(client_all_throughputs) / 3.
                client_stddev_latency = np.std(client_all_latencies)
                client_stddev_throughput = np.std(client_all_throughputs)

                if max_throughput_client < client_mean_throughput:
                    max_throughput_client = client_mean_throughput
                    print("TTT CLIENT", write, client_mean_throughput,
                          client_mean_latency)

                # Maximal values at: (printouts!)

                # Append to list
                client_throughput_means[_vc, _mt] = client_mean_throughput
                client_latency_means[_vc, _mt] = client_mean_latency
                client_throughput_stddev[_vc, _mt] = client_stddev_throughput
                client_latency_stddev[_vc, _mt] = client_stddev_latency

            print(client_throughput_means[:, _mt].flatten())
            print(total_virtual_clients)

            # Assertions
            len_mt = client_throughput_means[:, _mt].flatten().shape
            len_vc = client_throughput_means[:, _mt].flatten().shape
            len1 = virtual_clients

            print("All lengths are : ")
            print(len_mt)
            print(len_vc)
            print(len1)

        # THROUGHPUTS
        print("###write:client ", write, client_throughput_means)
        print("###write:middleware ", write, mw_throughput_means)

        # LATENCIES
        print("###write:client ", write, client_latency_means)
        print("###write:middleware ", write, mw_latency_means)

        ###write:client  0 [[2829.99666667 2828.78       2841.12333333 2832.09666667]
        # [2914.32       2916.49       2902.36666667 2963.79      ]
        # [2978.07       2982.04       2926.90666667 2961.14      ]
        # [2930.64       2996.5        2980.55333333 2971.27666667]
        # [2920.55666667 2939.13       2975.22333333 2949.03333333]
        # [2966.08666667 2969.74666667 2933.78       2944.79      ]]
        # ###write:middleware  0 [[2888.56768177 2872.94686583 2876.40834308 2863.0490837 ]
        # [2952.04131319 2937.70233791 2918.01762357 2947.80422581]
        # [2989.20268883 2974.35714111 2912.9803837  2934.38863854]
        # [2933.52705812 2979.39794505 2961.4934029  2940.88512509]
        # [2915.57629929 2930.44136708 2952.3195043  2941.34950968]
        # [2983.28945045 2974.97495859 2925.1779705  2935.00349311]]
        # ###write:client  0 [[ 2.11333333  2.11222222  2.10555556  2.11111111]
        # [ 4.12222222  4.11555556  4.14        4.04888889]
        # [ 8.06        8.05444444  8.19444444  8.10111111]
        # [16.44666667 16.03333333 16.06111111 16.17111111]
        # [32.96       32.63777778 32.23333333 32.51333333]
        # [64.82444444 64.60222222 65.45       65.20888889]]
        # ###write:middleware  0 [[ 1.3167424   1.18404118  1.19176319  1.17406692]
        # [ 3.05772075  3.06435006  3.08202826  3.02690768]
        # [ 7.03875969  6.86615187  6.97812098  6.82174604]
        # [15.12661499 14.78340234 14.6029601  14.49839125]
        # [31.04134367 30.77606178 30.94594595 30.51061114]
        # [64.37984496 63.11079911 63.46138996 62.44980695]]

        ###write:client  1 [[3271.34       3220.32666667 3215.53333333 3321.11666667]
        # [5386.31666667 5549.33333333 5136.30666667 5292.51333333]
        # [6729.64333333 6900.06333333 6690.59666667 6214.48333333]
        # [7061.56       7363.10333333 7541.20666667 7139.32333333]
        # [7295.09       7490.80666667 7629.65333333 6914.55      ]
        # [7228.72       6711.01666667 7753.10333333 7454.68      ]]
        # ###write:middleware  1 [[3287.41072931 3284.10276218 3236.10885263 3348.17928571]
        # [5425.01178366 5583.56806439 5174.72885707 5332.7263551 ]
        # [6667.75480504 6881.43820305 6818.78960064 7011.40707111]
        # [6968.99163433 7292.81531008 7476.06856816 7092.02329642]
        # [7199.49091298 7430.69321895 7658.79654156 7739.66985074]
        # [7369.68367374 7615.74155019 7635.26281836 7333.33824439]]
        # ###write:client  1 [[ 1.83333333  1.86333333  1.86444444  1.80555556]
        # [ 2.24777778  2.16444444  2.34555556  2.28      ]
        # [ 3.58        3.48222222  3.48888889  3.41111111]
        # [ 6.81444444  6.53555556  6.38222222  6.77      ]
        # [13.19111111 12.80444444 12.57444444 12.30222222]
        # [26.64888889 25.42666667 24.74444444 25.82111111]]
        # ###write:middleware  1 [[ 0.95865633  0.99356499  0.98584299  0.94144144]
        # [ 1.05426357  1.07722008  1.14740262  1.10841916]
        # [ 1.73901809  1.4002574   1.41508969  1.48529033]
        # [ 3.26873385  1.85971686  1.72651223  1.84685326]
        # [ 5.56330749  2.57014157  2.15837807  2.01412311]
        # [15.27655236  3.07501152  2.19581187  2.69169728]]

        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=client_throughput_means.T,
            stddev_array=client_throughput_stddev.T,
            filepath=GRAPHPATH +
            "exp3_1__throughput_client_write_{}".format(write),
            is_latency=False)
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=client_latency_means.T,
            stddev_array=client_latency_stddev.T,
            filepath=GRAPHPATH +
            "exp3_1__latency_client_write_{}".format(write),
            is_latency=True)

        # Plot the middleware values
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=mw_throughput_means.T,
            stddev_array=mw_throughput_stddev.T,
            filepath=GRAPHPATH +
            "exp3_1__throughput_middleware_write_{}".format(write),
            is_latency=False)
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=mw_latency_means.T,
            stddev_array=mw_latency_stddev.T,
            filepath=GRAPHPATH +
            "exp3_1__latency_middleware_write_{}".format(write),
            is_latency=True)
示例#4
0
def iterate_through_experiments_exp3_2():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)

    middleware_threads = [(2**x) for x in range(3, 7)]
    virtual_clients = [(2**x) for x in range(0, 6)]

    total_virtual_clients = len([(2**x) for x in range(0, 6)])
    total_middleware_threads = len([(2**x) for x in range(3, 7)])

    for write in [1]:

        mw_queueusize_means = np.zeros(
            (total_virtual_clients, total_middleware_threads))
        mw_queueusize_stddev = np.zeros(
            (total_virtual_clients, total_middleware_threads))

        for _vc in range(0, 6):
            vc = (2**_vc)

            for _mt in range(3 - 3, 7 - 3):
                mt = (2**(_mt + 3))

                all_queuesizes = []

                for repetition in range(3):

                    for middleware in [1, 2]:

                        # Get throughput and latency from the file
                        middleware_filename = get_pattern_exp4_1_middleware(
                            virtualclientthreads=vc,
                            middlewarethreads=mt,
                            repetition=repetition,
                            write=write,
                            middleware=middleware)

                        try:
                            df = parse_log(BASEPATH + middleware_filename)
                            avg_queuesize = get_average_queuesize(df)
                            all_queuesizes.append(avg_queuesize)

                        except Exception as e:
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

                print("VC and MT ", (mt, vc))
                print("NEW VC and MT ", (_mt, _vc))

                mw_mean_queuesize = np.mean(all_queuesizes)
                mw_stddev_queuesize = np.std(all_queuesizes)
                # Append to list
                mw_queueusize_means[_vc, _mt] = mw_mean_queuesize
                mw_queueusize_stddev[_vc, _mt] = mw_stddev_queuesize

        # Plot the middleware values
        render_lineargraph_multiple_errorbars(
            labels=virtual_clients,
            mean_array=mw_queueusize_means.T,
            stddev_array=mw_queueusize_stddev.T,
            filepath=GRAPHPATH +
            "exp4_1__queuesize_middleware_write_{}".format(write),
            is_latency=False,
            is_queue_size=True)
示例#5
0
def create_queue_barplots():
    create_datadir_if_not_exists(GRAPHPATH)

    middleware_threads = [(2**x) for x in range(3, 7)]
    virtual_clients = [(2**x) for x in range(0, 6)]

    total_virtual_clients = len([(2**x) for x in range(0, 6)])
    total_middleware_threads = len([(2**x) for x in range(3, 7)])

    # The following are the different values we're going to plot:
    #
    time_labels = [
        'Time to Enqueue', 'Time in Queue', 'Time Queue to Server',
        'Time at Server', 'Time Server to Client'
    ]

    print("Time labels have shape: ", len(time_labels))

    for write in [0, 1]:

        for _vc in range(0, 6):
            vc = (2**_vc)

            middleware_latencies = np.zeros(
                (total_middleware_threads, len(time_labels), 1,
                 3))  # 3 repetitions, 2 middlewares

            for _mt, mt in enumerate(middleware_threads):

                # ONCE FOR THE MIDDLEWARE
                for repetition in range(3):

                    for middleware in [1]:
                        # Get throughput and latency from the file
                        middleware_filename = get_pattern_exp3_1_middleware(
                            virtualclientthreads=vc,
                            middlewarethreads=mt,
                            repetition=repetition,
                            write=write,
                        )

                        try:
                            df = parse_log(BASEPATH + middleware_filename)
                            middleware_latencies[
                                _mt, :, middleware - 1,
                                repetition] = get_average_queue_components(df)
                            # print("item is: ", middleware_latencies[_mt, :, middleware - 1, repetition])
                            # print(middleware_latencies)
                        except Exception as e:
                            # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

            # Normalizing the graphs to the appropriate shapes by taking means (and calculating stddevs)
            mean_middleware_latencies = np.mean(middleware_latencies,
                                                axis=2,
                                                keepdims=True)
            stddev_middleware_latencies = np.std(mean_middleware_latencies,
                                                 axis=3,
                                                 keepdims=True)
            mean_middleware_latencies = np.mean(mean_middleware_latencies,
                                                axis=3,
                                                keepdims=True)

            mw_means = mean_middleware_latencies.squeeze().T
            mw_stddev = stddev_middleware_latencies.squeeze().T

            print("Means and Stddev")
            print(mw_means.shape)
            print(mw_stddev.shape)
            print(len(time_labels))
            print(time_labels)

            print(mw_means)

            create_multiple_histogram_plot(
                keys=middleware_threads,
                means=mw_means.T,
                stddevs=mw_stddev.T,
                filepath=GRAPHPATH +
                "exp3_1_mw_percentile_plots_writes_{}__vc_{}".format(
                    write, vc),
                is_queue=True)
示例#6
0
def iterate_through_experiments_exp4_1():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)
    write = 1  # This experiment consists of writes-only!

    middleware_threads = [(2**x) for x in range(3, 7)]
    virtual_clients = [(2**x) for x in range(0, 6)]

    total_virtual_clients = len([(2**x) for x in range(0, 6)])
    total_middleware_threads = len([(2**x) for x in range(3, 7)])

    mw_throughput_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_throughput_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_latency_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_latency_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))

    client_throughput_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_latency_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_throughput_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_latency_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))

    queuetime_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    queuelength_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    waittime_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))

    for _mt in range(3 - 3, 7 - 3):
        mt = (2**(_mt + 3))

        for _vc in range(0, 6):
            vc = (2**_vc)

            client_all_throughputs = [
            ]  # From here on, we average over all values
            client_all_latencies = []

            mw_all_throughputs = []
            mw_all_latencies = []

            queuetimes = []
            queuelengths = []
            waittimes = []

            for repetition in range(3):

                for middleware in [1, 2]:
                    # Get throughput and latency from the file
                    middleware_filename = get_pattern_exp4_1_middleware(
                        virtualclientthreads=vc,
                        middlewarethreads=mt,
                        repetition=repetition,
                        write=write,
                        middleware=middleware)

                    try:
                        df = parse_log(BASEPATH + middleware_filename)

                        # Append queuetimes, queuelength and waittime
                        queuetimes.append(
                            df['differenceTimeEnqueuedAndDequeued'].astype(
                                float).mean())
                        queuelengths.append(
                            df['queueSize'].astype(float).mean())
                        waittimes.append(df[
                            'differenceTimeSentToServerAndReceivedResponseFromServer']
                                         .astype(float).mean())

                        mw_throughput, mw_latency = get_latency_log_dataframe(
                            df)
                        mw_throughput *= mt * 1000  # bcs this gives us throughput per millisecond

                        # print("THROUGHPUT AND LATENCY ARE: ")
                        # print(mw_throughput)
                        # print(mw_latency)

                        mw_all_throughputs.append(mw_throughput)
                        mw_all_latencies.append(mw_latency)

                    except Exception as e:
                        # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                        print("WRONG WITH THE FOLLOWING CONFIG: ",
                              middleware_filename)
                        print(e)
                        continue

                for client in ['Client1', 'Client2', 'Client3']:

                    for middleware in [1, 2]:

                        # Trying to open and read the file!
                        client_filename = get_pattern_exp4_1_client(
                            virtual_client_threads=vc,
                            middleware=middleware,
                            middlewareworkerthreads=mt,
                            repetition=repetition,
                            client=client,
                            write=write)

                        try:
                            client_throughput, client_latency = get_throughput_latency_default_memtier(
                                filepath=BASEPATH + client_filename)
                            client_all_throughputs.append(client_throughput)
                            client_all_latencies.append(client_latency)

                        except Exception as e:
                            # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

            # Queuetimes etc.
            queuetime_means[_vc, _mt] = np.mean(queuetimes)
            queuelength_means[_vc, _mt] = np.mean(queuelengths)
            waittime_means[_vc, _mt] = np.mean(waittimes)

            mw_mean_latency = np.mean(mw_all_latencies)
            mw_mean_throughput = np.sum(mw_all_throughputs) / 3.
            mw_stddev_latency = np.std(mw_all_latencies)
            mw_stddev_throughput = np.std(mw_all_throughputs)
            # Append to list
            mw_throughput_means[_vc, _mt] = mw_mean_throughput
            mw_latency_means[_vc, _mt] = mw_mean_latency
            mw_throughput_stddev[_vc, _mt] = mw_stddev_throughput
            mw_latency_stddev[_vc, _mt] = mw_stddev_latency

            client_mean_latency = np.mean(client_all_latencies)
            client_mean_throughput = np.sum(client_all_throughputs) / 3.
            client_stddev_latency = np.std(client_all_latencies)
            client_stddev_throughput = np.std(client_all_throughputs)
            # Append to list
            client_throughput_means[_vc, _mt] = client_mean_throughput
            client_latency_means[_vc, _mt] = client_mean_latency
            client_throughput_stddev[_vc, _mt] = client_stddev_throughput
            client_latency_stddev[_vc, _mt] = client_stddev_latency

        # Assertions
        len_mt = client_throughput_means[:, _mt].flatten().shape
        len_vc = client_throughput_means[:, _mt].flatten().shape
        len1 = virtual_clients

    argmax_vc = np.argmax(mw_throughput_means, axis=0)
    print("MW throughputs are: ", mw_throughput_means)
    print("VC maximizing is: ", argmax_vc)

    for idx, mt in enumerate([8, 16, 32, 64]):

        max_vc = argmax_vc[idx]
        print()
        print()
        print()

        print("MT IS: ", mt)
        # Section 7 data
        # print("###write:client ", client_throughput_means[max_vc, idx])
        # print("###write:middleware ", mw_throughput_means[max_vc, idx])
        print("###write:queuesizes ", queuelength_means[max_vc, idx])
        print("###write:latency ", mw_latency_means[max_vc, idx])
        print("###write:waittime_means ",
              waittime_means[max_vc, idx] / 1000000.)

    ###write:client  1
    # [[ 1815.45333333  2321.54        2285.64        2127.40333333]
    # [ 4608.49        4581.64        4576.45333333  4406.16333333]
    # [ 6971.06666667  6543.16333333  7374.53333333  6144.32333333]
    # [ 8698.22666667  8063.80666667  9086.58        9738.00333333]
    # [ 8995.92       10068.55333333 11404.78       10261.27      ]
    # [ 7064.09333333 10026.83333333 12586.12       12858.95333333]]
    # ###write:middleware  1
    # [[ 1947.229088    2317.76063679  2322.53675249  2207.33621436]
    # [ 4591.30620045  4605.04654336  4582.13005631  4509.73165549]
    # [ 8020.03037995  6967.31991722  7475.40874085  7804.08509258]
    # [ 8645.69236829 10314.9812626   9302.41430409  9688.76860568]
    # [ 8833.92859926 10153.21361682 12126.18091513 10299.9702301 ]
    # [ 7465.56068924 10133.52159323 12503.89763076 13706.73554513]]

    # Taken out for experiment 7!
    # Plot the client values
    render_lineargraph_multiple_errorbars(
        labels=virtual_clients,
        mean_array=client_throughput_means.T,
        stddev_array=client_throughput_stddev.T,
        filepath=GRAPHPATH +
        "exp4_1__vc_{}__throughput_client_write_{}".format(mt, write),
        is_latency=False)
    render_lineargraph_multiple_errorbars(
        labels=virtual_clients,
        mean_array=client_latency_means.T,
        stddev_array=client_latency_stddev.T,
        filepath=GRAPHPATH +
        "exp4_1__vc_{}__latency_client_write_{}".format(mt, write),
        is_latency=True)

    # print(np.max(mw_throughput_means, axis=0))
    # print(np.max(mw_throughput_means, axis=1))

    # Plot the middleware values
    render_lineargraph_multiple_errorbars(
        labels=virtual_clients,
        mean_array=mw_throughput_means.T,
        stddev_array=mw_throughput_stddev.T,
        filepath=GRAPHPATH +
        "exp4_1__vc_{}__throughput_middleware_write_{}".format(mt, write),
        is_latency=False)
    render_lineargraph_multiple_errorbars(
        labels=virtual_clients,
        mean_array=mw_latency_means.T,
        stddev_array=mw_latency_stddev.T,
        filepath=GRAPHPATH +
        "exp4_1__vc_{}__latency_middleware_write_{}".format(mt, write),
        is_latency=True)
示例#7
0
def iterate_through_experiments_exp4_1():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)
    write = 1  # This experiment consists of writes-only!

    multikeys = ["1", "3", "6", "9"]
    shardings = [False, True]

    _number_keys = len(multikeys)
    _number_shardings = len(shardings)

    mw_throughput_means = np.zeros((_number_keys, _number_shardings))
    mw_throughput_stddev = np.zeros((_number_keys, _number_shardings))
    mw_latency_means = np.zeros((_number_keys, _number_shardings))
    mw_latency_stddev = np.zeros((_number_keys, _number_shardings))

    client_throughput_means = np.zeros((_number_keys, _number_shardings))
    client_latency_means = np.zeros((_number_keys, _number_shardings))
    client_throughput_stddev = np.zeros((_number_keys, _number_shardings))
    client_latency_stddev = np.zeros((_number_keys, _number_shardings))

    # Iterate through keysizes
    for jdx, sharding in enumerate(shardings):
        print("Sharding: ", sharding)

        for idx, keysize in enumerate(multikeys):
            print("Keysize is: ", keysize)

            client_all_throughputs = [
            ]  # From here on, we average over all values
            client_all_latencies = []

            mw_all_throughputs = []
            mw_all_latencies = []

            for repetition in range(3):

                for middleware in [1, 2]:
                    # Get throughput and latency from the file
                    middleware_filename = get_pattern_exp5_1_middleware(
                        middleware=middleware,
                        keysize=keysize,
                        repetition=repetition,
                        sharding=sharding)

                    try:
                        df = parse_log(BASEPATH + middleware_filename)
                        mw_throughput, mw_latency = get_latency_log_dataframe(
                            df)
                        mw_throughput *= 64 * 1000  # bcs this gives us throughput per millisecond

                        # print("THROUGHPUT AND LATENCY ARE: ")
                        # print(mw_throughput)
                        # print(mw_latency)

                        mw_all_throughputs.append(mw_throughput)
                        mw_all_latencies.append(mw_latency)

                    except Exception as e:
                        # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                        print("WRONG WITH THE FOLLOWING CONFIG: ",
                              middleware_filename)
                        print(e)
                        continue

                for client in ['Client1', 'Client2', 'Client3']:
                    for middleware in [1, 2]:

                        # TODO: Do it for each individual middleware!
                        # Trying to open and read the file!
                        client_filename = get_pattern_exp5_1_client(
                            keysize=keysize,
                            middleware=middleware,
                            repetition=repetition,
                            client=client,
                            sharding=sharding)

                        try:
                            client_throughput, client_latency = get_throughput_latency_default_memtier(
                                filepath=BASEPATH + client_filename)
                            client_all_throughputs.append(client_throughput)
                            client_all_latencies.append(client_latency)

                        except Exception as e:
                            # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

            mw_mean_latency = np.mean(mw_all_latencies)
            mw_mean_throughput = np.sum(mw_all_throughputs) / 3.
            mw_stddev_latency = np.std(mw_all_latencies)
            mw_stddev_throughput = np.std(mw_all_throughputs)
            # Append to list
            mw_throughput_means[idx, jdx] = mw_mean_throughput
            mw_latency_means[idx, jdx] = mw_mean_latency
            mw_throughput_stddev[idx, jdx] = mw_stddev_throughput
            mw_latency_stddev[idx, jdx] = mw_stddev_latency

            client_mean_latency = np.mean(client_all_latencies)
            client_mean_throughput = np.sum(client_all_throughputs) / 3.
            client_stddev_latency = np.std(client_all_latencies)
            client_stddev_throughput = np.std(client_all_throughputs)
            # Append to list
            client_throughput_means[idx, jdx] = client_mean_throughput
            client_latency_means[idx, jdx] = client_mean_latency
            client_throughput_stddev[idx, jdx] = client_stddev_throughput
            client_latency_stddev[idx, jdx] = client_stddev_latency

        # Middleware
        render_lineargraph_errorbars(
            labels=multikeys,
            mean_array=mw_latency_means[:, jdx],
            stddev_array=mw_latency_stddev[:, jdx],
            filepath=GRAPHPATH +
            "exp5_1__mw_latency_sharding_{}".format(sharding),
            is_latency=True)

        # Client
        render_lineargraph_errorbars(
            labels=multikeys,
            mean_array=client_latency_means[:, jdx],
            stddev_array=client_latency_stddev[:, jdx],
            filepath=GRAPHPATH +
            "exp5_1__client_latency_sharding_{}".format(sharding),
            is_latency=True)

        # Middleware
        render_lineargraph_errorbars(
            labels=multikeys,
            mean_array=mw_throughput_means[:, jdx],
            stddev_array=mw_throughput_stddev[:, jdx],
            filepath=GRAPHPATH +
            "exp5_1__mw_throughput_sharding_{}".format(sharding),
            is_latency=False)

        # Client
        render_lineargraph_errorbars(
            labels=multikeys,
            mean_array=client_throughput_means[:, jdx],
            stddev_array=client_throughput_stddev[:, jdx],
            filepath=GRAPHPATH +
            "exp5_1__client_throughput_sharding_{}".format(sharding),
            is_latency=False)
示例#8
0
def iterate_through_experiments_exp6_1():
    """
        Iterates through all the parameter combinations
    :return:
    """

    write = 1  # This experiment consists of writes-only!

    final_client_throughputs = []
    final_mw_throughputs = []

    final_client_latencies = []
    final_mw_latencies = []

    print("WRITES ARE:::: ", write)

    for number_of_middlewares in [1, 2]:

        for number_of_servers in [1, 3]:

            for number_of_middleware_workerthreads in [8, 32]:

                client_all_throughputs = [
                ]  # From here on, we average over all values
                client_all_latencies = []

                for repetition in range(3):

                    mw_all_throughputs = []
                    mw_all_latencies = []

                    _array_middlewares = [
                        1, 2
                    ] if number_of_middlewares == 2 else [1]
                    for middleware in _array_middlewares:
                        # Get throughput and latency from the file
                        middleware_filename = get_pattern_exp6_1_middleware(
                            middlewarethreads=
                            number_of_middleware_workerthreads,
                            number_of_middlewares=number_of_middlewares,
                            servers=number_of_servers,
                            repetition=repetition,
                            write=write,
                            middleware=middleware)

                        try:
                            df = parse_log(BASEPATH + middleware_filename)
                            mw_throughput, mw_latency = get_latency_log_dataframe(
                                df)
                            mw_throughput *= number_of_middleware_workerthreads * 1000  # bcs this gives us throughput per millisecond

                            # print("THROUGHPUT AND LATENCY ARE: ")
                            # print(mw_throughput)
                            # print(mw_latency)

                            mw_all_throughputs.append(mw_throughput)
                            mw_all_latencies.append(mw_latency)

                        except Exception as e:
                            # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

                    configuration = (number_of_middlewares, number_of_servers,
                                     number_of_middleware_workerthreads)

                    final_mw_throughputs.append(
                        (configuration, (repetition,
                                         np.sum(mw_all_throughputs))))

                    final_mw_latencies.append(
                        (configuration, (repetition,
                                         np.mean(mw_all_latencies))))

    # Iterating through individual lists for easy copy pasta
    # print("CLIENT THROUGHPUT")
    # for x in final_client_throughputs:
    #     print(x)

    print("MIDDLEWARE THROUGHPUT")
    for idx, x in enumerate(final_mw_throughputs):
        if idx % 3 == 0:
            print()
        print(x)

    # print("CLIENT LATENCY")
    # for x in final_client_latencies:
    #     print(x)

    print("MIDDLEWARE LATENCY")
    for idx, x in enumerate(final_mw_latencies):
        if idx % 3 == 0:
            print()
        print(x)
示例#9
0
def iterate_through_experiments_exp4_1():
    """
        Iterates through all the parameter combinations
    :return:
    """

    create_datadir_if_not_exists(GRAPHPATH)
    write = 1  # This experiment consists of writes-only!

    middleware_threads = [(2**x) for x in range(3, 7)]
    virtual_clients = [(2**x) for x in range(0, 6)]

    total_virtual_clients = len([(2**x) for x in range(0, 6)])
    total_middleware_threads = len([(2**x) for x in range(3, 7)])

    mw_throughput_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_throughput_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_latency_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    mw_latency_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))

    client_throughput_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_latency_means = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_throughput_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))
    client_latency_stddev = np.zeros(
        (total_virtual_clients, total_middleware_threads))

    for _mt in range(3 - 3, 7 - 3):
        mt = (2**(_mt + 3))

        queuetimes = []
        queuesizes = []
        waittimes = []

        for _vc in range(0, 6):
            vc = (2**_vc)

            client_all_throughputs = [
            ]  # From here on, we average over all values
            client_all_latencies = []

            mw_all_throughputs = []
            mw_all_latencies = []

            tmp_queuetimes = []
            tmp_queuesizes = []
            tmp_waittimes = []

            for repetition in range(3):

                for middleware in [1, 2]:
                    # Get throughput and latency from the file
                    middleware_filename = get_pattern_exp4_1_middleware(
                        virtualclientthreads=vc,
                        middlewarethreads=mt,
                        repetition=repetition,
                        write=write,
                        middleware=middleware)

                    try:
                        df = parse_log(BASEPATH + middleware_filename)

                        queuetime = df[
                            'differenceTimeEnqueuedAndDequeued'].astype(
                                float).mean() / 1000.
                        tmp_queuetimes.append(queuetime)
                        queuesize = df['queueSize'].astype(float).mean()
                        tmp_queuesizes.append(queuesize)
                        waittime = df[
                            'differenceTimeSentToServerAndReceivedResponseFromServer'].astype(
                                float).mean() / 1000.
                        tmp_waittimes.append(waittime)

                        mw_throughput, mw_latency = get_latency_log_dataframe(
                            df)
                        mw_throughput *= mt * 1000  # bcs this gives us throughput per millisecond

                        # print("THROUGHPUT AND LATENCY ARE: ")
                        # print(mw_throughput)
                        # print(mw_latency)

                        mw_all_throughputs.append(mw_throughput)
                        mw_all_latencies.append(mw_latency)

                    except Exception as e:
                        # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                        print("WRONG WITH THE FOLLOWING CONFIG: ",
                              middleware_filename)
                        print(e)
                        continue

                for client in ['Client1', 'Client2', 'Client3']:

                    for middleware in [1, 2]:

                        # Trying to open and read the file!
                        client_filename = get_pattern_exp4_1_client(
                            virtual_client_threads=vc,
                            middleware=middleware,
                            middlewareworkerthreads=mt,
                            repetition=repetition,
                            client=client,
                            write=write)

                        try:
                            client_throughput, client_latency = get_throughput_latency_default_memtier(
                                filepath=BASEPATH + client_filename)
                            client_all_throughputs.append(client_throughput)
                            client_all_latencies.append(client_latency)

                        except Exception as e:
                            # print("WRONG WITH THE FOLLOWING CONFIG: ", client_filename)
                            print("WRONG WITH THE FOLLOWING CONFIG: ",
                                  middleware_filename)
                            print(e)
                            continue

            queuetimes.append(np.mean(tmp_queuetimes))
            queuesizes.append(np.mean(tmp_queuesizes))
            waittimes.append(np.mean(tmp_waittimes))

            # print("VC and MT ", (mt, vc))
            # print("NEW VC and MT ", (_mt, _vc))

            mw_mean_latency = np.mean(mw_all_latencies)
            mw_mean_throughput = np.sum(mw_all_throughputs) / 3.
            mw_stddev_latency = np.std(mw_all_latencies)
            mw_stddev_throughput = np.std(mw_all_throughputs)
            # Append to list
            mw_throughput_means[_vc, _mt] = mw_mean_throughput
            mw_latency_means[_vc, _mt] = mw_mean_latency
            mw_throughput_stddev[_vc, _mt] = mw_stddev_throughput
            mw_latency_stddev[_vc, _mt] = mw_stddev_latency

            client_mean_latency = np.mean(client_all_latencies)
            client_mean_throughput = np.sum(client_all_throughputs) / 3.
            client_stddev_latency = np.std(client_all_latencies)
            client_stddev_throughput = np.std(client_all_throughputs)
            # Append to list
            client_throughput_means[_vc, _mt] = client_mean_throughput
            client_latency_means[_vc, _mt] = client_mean_latency
            client_throughput_stddev[_vc, _mt] = client_stddev_throughput
            client_latency_stddev[_vc, _mt] = client_stddev_latency

        print("MW IS: ", mt)
        argmax_vc = np.argmax(client_throughput_means[:, _mt].flatten())
        print("Argmax vc is: ", 2**argmax_vc)
        print("Max is: ", )
        print("queuesize: ", queuesizes[argmax_vc])
        print("waittimes: ", waittimes[argmax_vc])
        print("queuetimes: ", queuetimes[argmax_vc])
        print("Client troughput mean: ",
              client_throughput_means[argmax_vc, _mt].flatten())
        print("MW troughput mean: ", mw_throughput_means[argmax_vc,
                                                         _mt].flatten())
        print(
            "MW derived throughput time: ", 2 * 3 * (2**argmax_vc) /
            mw_latency_means[argmax_vc, _mt].flatten() * 1000)