(path, idx=0)
| 48 | |
| 49 | |
| 50 | def getCurve(path, idx=0): |
| 51 | df = pd.read_csv(path) |
| 52 | |
| 53 | # discard first 10 minutes |
| 54 | df = df[~df.invocationID.str.contains("^min[0-9]\.", regex=True)] |
| 55 | |
| 56 | print(path) |
| 57 | print(f"Failure percentage: {df[df['connectionTimeout'] | df['functionTimeout']].shape[0] / df.shape[0]}") |
| 58 | |
| 59 | df['function_hash'] = df['instance'].str.split("-").str[idx] |
| 60 | df = df.reset_index(drop=True) |
| 61 | df['slowdown'] = df['responseTime'] / df['requestedDuration'] |
| 62 | print(f"Slowdown < 1: {df[df['slowdown'] < 1].shape[0] / df.shape[0]}") |
| 63 | |
| 64 | # number of instances created |
| 65 | print(f"Number of instances created: {df['instance'].nunique()}") |
| 66 | |
| 67 | # filter functions with invalid slowdown |
| 68 | df = df[df['slowdown'] >= 1] |
| 69 | |
| 70 | df = df.groupby(df.function_hash).slowdown.apply(stats.gmean) |
| 71 | df = df.to_frame() |
| 72 | |
| 73 | # filter warm starts |
| 74 | # beforeWarmFilter = df.shape[0] |
| 75 | # df = df[df['actualDuration'] / df['responseTime'] <= 0.8] |
| 76 | # afterWarmFilter = df.shape[0] |
| 77 | # print(f"Warm start ratio: {(beforeWarmFilter - afterWarmFilter) / beforeWarmFilter}") |
| 78 | |
| 79 | print() |
| 80 | |
| 81 | print(path) |
| 82 | print(df.sort_values(by='slowdown', ascending=False).head(10)) |
| 83 | |
| 84 | print() |
| 85 | |
| 86 | return cdf(df, 'slowdown') |
| 87 | |
| 88 | |
| 89 | def plot_per_function_slowdown(): |
no test coverage detected