SLO-Aware Scheduling of Cloud Workloads
Profiling memcached and PARSEC batch jobs under hardware interference on Google Cloud, then scheduling them with Kubernetes and a dynamic controller that keeps memcached within its tail-latency SLO.
Code on GitHub · Cloud Computing Architecture, Systems Group, ETH Zürich (spring 2026)
Group members: Omkar Nitsure, Bhawana Bhawana and Adhithya Laxman Ravi Shankar Geetha.
This project studies how to run a latency-critical service, memcached, next to throughput-oriented batch jobs from the PARSEC and SPLASH-2x benchmark suites on Google Cloud. Part 1 measures memcached’s tail latency under different sources of hardware interference (iBench). Part 2 profiles how sensitive each batch job is to interference and how well it scales with threads. Part 3 designs a Kubernetes scheduling policy across two VMs, first by hand and then with LLM-driven search (OpenEvolve), that minimizes the makespan of the batch jobs while memcached serves 30K QPS within a 1 ms p95 latency SLO. Part 4 builds a dynamic controller for a single 4-core VM that resizes memcached’s core allocation as the load changes, keeping its p95 latency under 0.8 ms.
Part 1: Memcached under interference
We ran memcached alone and with each iBench source of interference (cpu, l1d, l1i, l2, llc, membw), sweeping the target load from 5K to 80K QPS with mcperf.
Tail latency and saturation point under each type of interference
-
ibench-cpu: Saturation point: 20–23K QPS. Tail latency elevated even at low QPS (1.5 ms p95 at 5K).
Explanation: ibench-cpu directly competes with memcached for CPU time on the same cores. Memcached is a multi-threaded, CPU-bound workload. When ibench saturates CPU cores, memcached threads spend more time waiting in the OS queue causing high latency even with light load. It is the most damaging kind of interference.
-
ibench-l1d: Saturation point: 33–38K QPS. Baseline latency unaffected (similar to no-interference at low QPS).
Explanation: L1 data cache interference evicts memcached’s cached data (recently accessed values) from L1d. Each L1d cache miss falls to L2 cache, adding a few cycles of latency per access. Since memcached’s critical path has many random lookups, this adds up under load and lowers the saturation point. But, because L2/LLC gets cache hits for most L1d misses, baseline latency at low QPS is nearly unchanged. The effect is moderate.
-
ibench-l1i: Saturation point: 25–26K QPS. Tail latency elevated at ALL load levels (0.9–1.7 ms p95 even at 5–10K QPS).
Explanation: L1 instruction cache interference evicts memcached’s cached code (the request-handling loop). Unlike data misses (L1d above) that occur selectively, instruction misses happen on every request since the same code is executed for every operation. This explains the unusually high baseline latency, even a single request at light load forces instruction re-fetches from L2. The saturation point collapses significantly and the curve is shifted upward, making ibench-l1i the second most severe interference after ibench-cpu.
-
ibench-l2: Saturation point: 35–38K QPS. Baseline latency close to no-interference at low QPS.
Explanation: L2 is a combined cache for data and instructions, so ibench-l2 evicts both code and data from memcached’s L2 cached information. However, since L2 is larger than L1, the impact requires higher load to manifest and the baseline latency is relatively unaffected. When the memcached’s cached information can no longer fit in LLC either (at high QPS), latency degrades sharply. The effect is comparable to ibench-l1d, moderate, with the knee shifted left of the baseline.
-
ibench-llc: Saturation point: 33–36K QPS. Gradually increasing baseline latency (visible curve slope even at low QPS).
Explanation: LLC is the last cache before DRAM. When ibench-llc evicts memcached’s cached information from the LLC, accesses must go to main memory, which has orders of magnitude more latency than cache. Memcached stores key-value pairs that don’t always fit in L1/L2, so LLC is critical. The degradation is more gradual because the LLC is large and not fully evicted at once, but under high QPS the pressure on cached information from memcached (due to more evictions) causes significant latency. The saturation point is much lower than baseline.
-
ibench-membw: Saturation point: 47–52K QPS — nearly identical to no-interference. Slightly elevated latency throughout.
Explanation: Memory bandwidth interference slows DRAM access when ibench-membw saturates the memory bus. However, memcached (at this scale) is largely served from LLC, so it is not memory-bandwidth-bound for the majority of requests. Only the fraction of requests that miss all cache levels is affected. This means the saturation point is nearly unchanged, and the modest latency increase reflects only the slower DRAM responses for cold misses (did not get hit in any of the caches). Of all interference types, ibench-membw has the least impact on memcached’s throughput.
Processor affinity
taskset -c <core list> sets the CPU affinity of a process, pinning it to specific cores. Without taskset, the OS scheduler could freely put processes on different cores, making interference experiments non-deterministic and uncontrolled.
Some iBench benchmarks run on the same core as memcached and others on a different core:
- ibench-cpu (core 0, same): CPU scheduling time is per-core. Both processes compete for time slices on the exact same physical core, creating direct CPU interference.
- ibench-l1d (core 0, same): The L1 data cache is private per-core (not shared). To evict memcached’s cached data from L1d, the interferer must run on the same core to populate the same cache.
- ibench-l1i (core 0, same): The L1 instruction cache is also private per-core. Running on the same core forces interference for instruction cache lines, evicting memcached’s cached code.
- ibench-l2 (core 0, same): On the Intel Lake platforms used in experiments, the L2 cache is also per-core private. Sharing the same core is required to cause L2 capacity interference.
- ibench-llc (core 1, different): The LLC is shared across all cores. Any process on any core of the same machine contends on the LLC. Core 1 is sufficient, no need to share core 0, which would combine LLC with CPU interference.
- ibench-membw (core 1, different): Memory bandwidth (DRAM channels and memory controllers) is shared across all cores. Any process running on any core can saturate the memory bus, so running on a separate core still creates bandwidth interference for memcached without adding CPU scheduling interference.
Collocation under an SLO of 2 ms p95 latency at 35K QPS
The following are safe to collocate without violating the SLO:
- ibench-l2: p95 ≈ 650 µs. L2 is a per-core resource, so running ibench-l2 on the same core does cause some slowdown (shifting the knee slightly left), but at 35K QPS the system has not yet saturated. The effect is mild enough to remain well within 2 ms.
- ibench-membw: p95 ≈ 1 ms. Memcached’s cached information is largely served from LLC at this scale, so only a small fraction of requests actually access DRAM. Memory bandwidth interference causes a modest but tolerable latency increase at 35K QPS.
All other benchmarks violate the 2 ms SLO: ibench-cpu and ibench-l1i collapse the saturation point below 35K QPS entirely, while ibench-l1d and ibench-llc raise p95 above 2 ms at 35K QPS.
Queueing model
Open or closed system. This is an open system. The mcperf load generator produces requests at an externally specified rate (target QPS) independently of server state. New requests are issued at the target rate whether or not prior requests have been serviced. In a closed system, a fixed pool of N clients would each wait for a response before issuing the next request, coupling the arrival rate to the server speed.
Number of clients. The number of concurrent TCP connections (clients) is 64, determined from the -T 8 -C 8 flags on the client-measure machine: 8 worker threads × 8 TCP connections per thread = 64. Each connection is an independent client submitting requests.
- Arrival process: Requests arrive at rate \(\lambda\) = target QPS (modeled as Poisson / open arrivals)
- Queue: Unbounded FIFO queue; requests wait when the server is busy
- Server: Single memcached thread pinned to core 0 (
-t 1+taskset -c 0), with general service time distribution - Departures: Responses returned to clients after service time S
Average response time.
\[E[R] = \underbrace{E[S]}_{\text{service time}} + \underbrace{\frac{\lambda \cdot E[S^2]}{2(1-\rho)}}_{\text{mean waiting time } E[W]}\]where:
- \(E[S]\) = mean service time per request (time memcached spends processing one lookup). In the no-interference baseline, \(E[S] \approx 1/50000 \approx 20\,\mu s\) (since saturation occurs around 50K QPS where \(\rho \to 1\)).
- \(\lambda\) = arrival rate = target QPS (e.g., 5,000 to 80,000 req/s in the experiment).
- \(\rho = \lambda \cdot E[S]\) = server utilization. When \(\rho \to 1\), the denominator \((1-\rho) \to 0\) and \(E[R] \to \infty\), this is the “knee” in the latency-vs-QPS curve.
- \(E[S^2]\) = second moment of service time; captures service time variability. Even at moderate utilization, high variance in \(S\) inflates queueing delay.
- The first term \(E[S]\) is the unavoidable processing time; the second term \(E[W]\) is the queueing delay, which grows sharply at saturation.
Cost analysis
| VM role | Machine type | vCPUs | RAM | $/hr |
|---|---|---|---|---|
| master | n2-standard-2 | 2 | 8 GB | $0.1068 |
| memcache-server | e2-highcpu-2 | 2 | 2 GB | $0.0544 |
| client-measure | n2-standard-2 | 2 | 8 GB | $0.1068 |
| client-agent | e2-standard-8 | 8 | 32 GB | $0.2949 |
| Total | $0.5629/hr |
The experiments took roughly 3–4 hours. The theoretical cost was $1.69–2.25, and the actual cost $2.01. The costs indeed match quite well up to the first decimal place. This is expected as we don’t recollect the exact amount of time we were working but only have a good enough rough idea which matches with the computational results.
Part 2: Batch jobs under interference and with multiple threads
Interference profile
| Workload | none | cpu | l1d | l1i | l2 | llc | memBW |
|---|---|---|---|---|---|---|---|
| barnes | 1.00 | 1.55 | 1.84 | 2.17 | 1.89 | 2.54 | 1.71 |
| blackscholes | 1.00 | 0.58 | 0.59 | 0.67 | 0.59 | 0.62 | 0.57 |
| canneal | 1.00 | 0.96 | 1.22 | 1.27 | 1.25 | 1.64 | 1.15 |
| freqmine | 1.00 | 1.77 | 1.14 | 1.77 | 1.12 | 1.50 | 1.35 |
| radix | 1.00 | 0.96 | 1.06 | 1.01 | 0.98 | 1.31 | 0.91 |
| streamcluster | 1.00 | 1.23 | 1.28 | 1.42 | 1.32 | 1.76 | 1.22 |
| vips | 1.00 | 1.45 | 1.58 | 1.58 | 1.46 | 1.64 | 1.37 |
Resource requirements of each job
-
barnes: Highly sensitive to all cache levels (l1d: 1.84×, l1i: 2.17×, l2: 1.89×, LLC: 2.54×) and memory bandwidth (1.71×).
Explanation: Barnes is an N-body gravitational simulation that builds and traverses trees over particle data. The tree traversals generate irregular, non-sequential memory accesses that defeat hardware prefetchers, putting a lot of stress on all cache levels (previously fetched data doesn’t frequently get hit). The LLC sensitivity (2.54×) is the worst among all workloads, indicating that caching full benchmark information significantly exceeds L2 but is partially captured by LLC.
-
blackscholes: Insensitive to all interference types (all normalized values ≈ 0.57–0.67).
Explanation: Blackscholes prices financial options via the Black-Scholes PDE on a large array. The access pattern is perfectly regular and stride-1 (accessed in sequence in an array), allowing hardware prefetchers to fully hide memory latency. The computations are also floating point with minimal need of memory bandwidth (minimal effect).
-
canneal: Insensitive to CPU and most cache interference (cpu: 0.96×, l1d: 1.22×, l1i: 1.27×, l2: 1.25×, membw: 1.15×), but moderately sensitive to LLC (1.64×).
Explanation: Canneal performs simulated annealing for VLSI routing, randomly selecting and evaluating swap moves in a netlist graph. The random access pattern generates LLC misses but the workload information is moderate enough to be cached and thus only LLC interference measurably degrades performance. Once everything is in cache it can always be fetched from the LLC even if there is interference in L1/L2, thus these interferences do not affect performance drastically.
-
freqmine: CPU-sensitive (1.77×), also sensitive to L1i (1.77×) and LLC (1.50×), broadly sensitive to membw (1.35×).
Explanation: Freqmine mines frequent itemsets using FP-growth, which involves iteratively scanning and building prefix trees over transaction databases. The repeated scans are CPU sensitive, and tree traversals stress caches. Thus there is broad sensitivity to different interferences as the workload requires all these resources.
-
radix: Nearly insensitive to CPU, all cache levels, and memory bandwidth (all ≤ 1.06), with only mild LLC sensitivity (1.31×).
Explanation: Radix sort is a bucket-based integer sort that processes data in sequential passes (great locality and thus many cache hits). The slight LLC sensitivity reflects the array size (large integer arrays), but the access pattern is so regular that interference has minimal impact.
-
streamcluster: Moderately sensitive to L1i (1.42×), L2 (1.32×), LLC (1.76×), and mildly to CPU/membw/l1d (1.22–1.28×).
Explanation: Streamcluster performs online k-median clustering, repeatedly computing distances between points in high-dimensional space. The inner loop accesses cluster centers and data points with some regularity, but the cache sensitivity reflects the need to hold both the current data chunk and cluster center coordinates in cache simultaneously (not all of these can be contained within the cache with interference leading to sensitivity).
-
vips: Broadly sensitive to all interference types (1.37–1.64×), no single dominant bottleneck resource as such.
Explanation: VIPS is an image processing pipeline applying multiple filters (convolution, color transforms, etc.) to large images. The uniform sensitivity across all types reflects this multi-stage heterogeneous workload. Stress on all resources throughout the run also indicates that each stage in the pipeline has different memory/compute characteristics.
Candidates for collocation with memcached (SLO of 2 ms p95 latency at 40K QPS)
blackscholes shows effectively zero sensitivity to all six interference types (all normalized values ≤ 1.0, i.e., no measurable degradation). It causes negligible cache and memory bandwidth pressure due to its perfectly regular, stride-1 memory access pattern. Co-locating it with memcached poses minimal risk to memcached’s LLC/memory bandwidth resources or tail latency.
radix is similarly robust, with normalized times ≤ 1.06 under CPU, l1d, l1i, l2, and membw interference, and only 1.31× under LLC. Its streaming access pattern means it does not generate irregular access patterns that affect a latency-sensitive service like memcached.
Parallel behavior
We consider a speedup significant when it achieves an efficiency of at least 50% at 8 threads, i.e., speedup ≥ 4.0 (half of ideal linear speedup of 8×). Below that threshold, the parallelism overhead and sequential bottlenecks outweigh the benefit.
- barnes: speedup 1.98 → 3.79 → 4.85: Sub-linear but significant (efficiency 61% at 8T). Good scaling up to 4 threads (near-ideal at 2T), with diminishing returns at 8T.
- blackscholes: speedup 1.69 → 2.60 → 3.04: Sub-linear, not significant (efficiency only 38% at 8T). The native dataset is not large enough to amortize parallelization costs at 8 threads.
- canneal: speedup 1.48 → 2.35 → 3.07: Sub-linear, not significant (efficiency 38% at 8T). The irregular, random memory access pattern causes high cache coherence traffic that worsens with thread count.
- freqmine: speedup 1.99 → 3.48 → 5.06: Sub-linear but significant (efficiency 63% at 8T). Strong scaling throughout with near-ideal at 2T (1.99×) and maintains good efficiency at 8T. FP-growth can partition the transaction database across threads with limited communication, making it well-suited to shared-memory parallelism.
- radix: speedup 1.97 → 3.76 → 6.28: Near-linear to super-linear at 8 threads. Highly significant (efficiency 79% at 8T). This is the best-scaling workload. The super-linear component at 8T likely arises from cache: with 8 threads each working on a smaller partition, the data per thread fits better in L1/L2, reducing cache miss rates beyond the linear speedup.
- streamcluster: speedup 1.82 → 3.04 → 4.10: Sub-linear but significant at 8T (efficiency 51%). Reasonable scaling due to parallelizing distance computations across data points. Diminishing returns might be due to synchronization.
- vips: speedup 1.87 → 3.74 → 4.32: Sub-linear, borderline significant (efficiency 54% at 8T). Near-ideal scaling at 2T (1.87×) and 4T (3.74×), but marked slowdown at 8T. The image pipeline processes tiles independently up to a point, but at 8T the tiles become small enough for the synchronization to affect speedup.
Part 3: Co-scheduling memcached and batch jobs on Kubernetes
Memcached serves a steady load of 30K QPS while the seven batch jobs run on two VMs: node-a (8 cores) and node-b (4 cores). The goal is to finish all batch jobs as fast as possible while keeping memcached’s p95 latency under 1 ms.
Hand-crafted policy
node_a [1,2,3,4]: barnes(4T) -> freqmine(4T) -> blackscholes(4T)
node_a [5,6,7] : canneal(3T) -> radix(2T)
node_b [0,1,2,3]: streamcluster(4T) -> vips(4T)
We ran the entire workflow 3 separate times with this policy:
| Job | Mean time [s] | Std [s] |
|---|---|---|
| barnes | 38.67 | 0.47 |
| blackscholes | 34 | 1.63 |
| canneal | 136.33 | 0.47 |
| freqmine | 113.33 | 0.94 |
| radix | 19.67 | 0.47 |
| streamcluster | 148.67 | 1.69 |
| vips | 44 | 2.16 |
| Total time | 200.33 | 2.05 |
Across the three runs, the mean SLO violation ratio is 0.00 with standard deviation 0.00.
Where memcached runs
Memcached runs on node-a-8core (e2-standard-8, 8 vCPUs), hard-pinned to core 0 via taskset -c 0 with 1 thread (-t 1). The reason is that memcached needs exactly 1 core, and placing it on node-a leaves 7 cores free for batch work rather than wasting capacity on the 4-core node-b which is a high performance cpu machine (much more useful for the cpu intensive, time consuming batch jobs). It also keeps the latency-sensitive service on the higher-clock-speed general-purpose machine, which is better for latency-sensitive networking.
Where each batch job runs
The 2 nodes were divided into 3 slots where different jobs were scheduled in a sequential manner. The 3 slots ensured that there was always a job-level parallelism where 2 jobs on node-a shared resources while jobs which were impacted by a variety of interferences were run in isolation on node-b. A core was completely dedicated to memcached on node-a as it gets impacted the most by cpu-interference (as seen in Part 1). Thus we are left with 7 cores on node-a and 4 cores on node-b. Node-a cores were split in 2 slots of 4 and 3 cores each.
- barnes: node-a-8core (cores 1, 2, 3, 4). Barnes was impacted by all interferences but as all slots on node-b were already occupied with jobs, it had to be run on node-a. It was scheduled on the slot with 4 cores (and not 3) as it was able to leverage more cores through excellent parallelism (as seen in Figure 3).
- blackscholes: node-a-8core (cores 1, 2, 3, 4). Blackscholes was the limiting job i.e. the job that finished last and thus affected the total makespan. To minimize the running time of the job that decides the makespan, it was scheduled on the slot with 4 cores on node-a to finish it as early as possible.
- canneal: node-a-8core (cores 5, 6, 7). Canneal was scheduled on the slot with 3 cores (and not 4) on node-a as canneal cannot be easily parallelised and in fact has one of the worst speedups with increasing cores as seen in Figure 3.
- freqmine: node-a-8core (cores 1, 2, 3, 4). Freqmine was scheduled on the slot with 4 cores on node-a as freqmine is a long heavy job and works well with 3 to 4 cores as seen in Figure 3.
- radix: node-a-8core (cores 5, 6, 7). Radix is a memory intensive job and does not fit on node-b thus it had to be run on one of the 2 slots on node-a. Radix is highly parallelisable and thus finishes very quickly even on 3 cores and thus it was better to schedule it with 3 cores so that the other slot with more cores can be used for a longer running job (blackscholes in our case).
- streamcluster: node-b-4core (cores 0, 1, 2, 3). Streamcluster was impacted by a variety of interferences as seen in Table 2 (l1i, l2, llc). It also is the longest running job in presence of any interference and thus needed to be run in isolation to finish early in a reasonable amount of time.
- vips: node-b-4core (cores 0, 1, 2, 3). Vips was impacted by all types of interferences (Table 2) and thus had to be run in isolation for the best performance. Thus it was scheduled on node-b.
Which jobs are colocated
Streamcluster and Vips run completely independently of all other jobs and themselves run sequentially, so there is no colocation involved at all. Pairs of jobs that are colocated are (barnes, canneal), (canneal, freqmine) and (freqmine, radix). Barnes is affected by all resources as seen in Table 2 and thus it was started as the first job of the first slot with canneal which is not affected much by interference (Table 2). This ensures that barnes runs with a job that is not affected by interference. Freqmine similarly is affected by different interferences and thus is scheduled to run alongside canneal which does not get affected much. Radix is also not affected much by interference (Table 2) and thus is colocated with the more sensitive freqmine job.
| Time window (approx.) | Active batch jobs |
|---|---|
| 0–39 s | barnes, canneal, streamcluster |
| 39–113 s | freqmine, canneal, streamcluster |
| 113–136 s | freqmine, radix, streamcluster |
| 136–148 s | freqmine, radix, vips |
| 148–153 s | freqmine, vips |
| 153–193 s | blackscholes, vips |
| 193–200 s | blackscholes (alone) |
Order of the batch jobs
Order: barnes, canneal, streamcluster, freqmine, radix, vips, blackscholes.
The longer jobs were first started together in different core slots on the 2 machines. The smaller jobs were then spread across different slots in a way that all slots roughly finish at the same time. Barnes was chosen instead of freqmine to initially run on slot-a as it is more sensitive to any kind of outside interference than freqmine. This allowed it to finish executing alongside canneal which is not much sensitive to interference. Also this prevented it from getting affected by the transition between 2 jobs and the resultant interference (canneal and radix in our case). All other scheduling is done considering longer jobs are to be scheduled before shorter jobs.
Threads per batch job
- barnes: 4. Shows excellent parallelism and thus can effectively use all 4 vcores to achieve significant speedup.
- blackscholes: 4. Not highly parallelisable with diminishing returns but still given the maximum available cores for best performance.
- canneal: 3. Not highly parallelisable and was the reason being scheduled on the slot with less cores but given the full cores available in the slot for the threads (3 threads).
- freqmine: 4. Shows good parallelism up to 4 cores and thus can effectively use all 4 cores to achieve speedup.
- radix: 2. It’s a splash2x job and thus must have threads which are a power of 2. Having 4 or more threads on 3 cores resulted in significant latency compared to using 2 cores likely due to the increased overhead of context switching (also the effect is diminishing as the job runs for only about 20 seconds).
- streamcluster: 4. Not highly parallelisable but allocated threads equal to the cores for best performance.
- vips: 4. Even though it is highly parallelisable and run in isolation, scheduling it with more threads than available cores degraded performance likely due to context switching and communication overhead. Thus we used one thread per core for the final policy.
Implementation
| File | Change |
|---|---|
parsec-benchmarks/part3.1/*.yaml | Define node placement, core pinning, thread count |
run_part3.sh | 3-slot scheduling loop with kubectl polling |
plot_part3.py | New: PDF timeline plots (p95 latency + core occupancy) |
Kubernetes features used:
- Job with
restartPolicy: Neverfor each PARSEC/SPLASH2x batch workload - Pod (long-running) for memcached
- Service (type LoadBalancer, port 11211) to expose memcached to client VMs
- nodeSelector (
cca-project-nodetype: "node-a-8core"/"node-b-4core") for deterministic node placement - Container args with
taskset -c <corelist>for sub-node CPU core pinning (kernel-level, not kubelet CPU Manager)
Second-best policy
The second-best policy, with an average makespan of 225 seconds, is as follows:
node-a-8core:
Slot A (1-4): barnes -n 4 -> freqmine -n 4 -> radix -n 2
Slot B (5-7): blackscholes -n 3 -> canneal -n 3
node-b-4core:
Slot C (0-3): streamcluster -n 4 -> vips -n 4
This policy has the same scheduling on node-b but somewhat different scheduling on node-a. Analyzing further, we found the main reason for the non-optimal makespan. Radix which executes very quickly (~15 s) was scheduled on slot A which has 4 cores while the relatively long running blackscholes job was scheduled on Slot B with only 3 cores. This caused node-a, Slot B to become the straggler while the other 2 finished early. There was no scope for further optimization of node-b but swapping radix and blackscholes could clearly help evenly distribute workload across the 2 slots. This code change indeed resulted in the necessary speedup taking the total makespan to as low as 200 seconds.
AI-generated policy with OpenEvolve
Performance
The SLO violation ratio for memcached remains 0 even for the AI generated policy. The total and job level makespan comparison is given in Table 6. The small differences in execution time is solely due to noise in the cluster setup as both these experiments were run on 2 different days. Both policies are exactly the same and we were not able to improve the policy further from our baseline handcrafted policy using OpenEvolve.
| Job | Mean time [s] (baseline) | Mean time [s] (AI) |
|---|---|---|
| barnes | 38.67 | 40.33 |
| blackscholes | 34 | 34 |
| canneal | 136.33 | 148.67 |
| freqmine | 113.33 | 112.67 |
| radix | 19.67 | 19.67 |
| streamcluster | 148.67 | 144.0 |
| vips | 44 | 45.0 |
| Total time | 200.33 | 203.67 |
Iterations and LLM used
We ran the OpenEvolve framework for 40 iterations across two phases of 20 iterations each (Phase 1: iterations 1–20, prompt1 with top_p = 0.9 and temperature = 0.9; Phase 2: iterations 21–40, prompt1 with top_p = 0.7 and temperature = 0.8). Prompt1 was written in such a way to encourage the LLM to explore more policies. The model used throughout was meta-llama/Llama-3.3-70B-Instruct. In total, 62 unique program variants were evaluated by the cluster: 40 were structurally valid (score = −makespan) and 22 produced hard-constraint failures (score = −10,000).
Success metric
The scoring function was deliberately single-objective:
\[\text{score} = -\text{makespan}_{\text{seconds}}\]- Makespan is the direct optimisation target (higher, i.e. less negative, score = faster completion).
- SLO compliance is not scored; it is enforced structurally. Core 0 on
node-ais reserved exclusively for memcached, and the_validate()function rejects any schedule that attempts to assign a batch job to core 0 onnode-a(valid range is[1..7]). Batch jobs therefore cannot compete with memcached for CPU resources regardless of what the LLM generates. - A hard-constraint gate is applied first: any schedule that fails structural validation (missing jobs, core range violations, duplicate jobs, or
threads <= 0andthreads > cores) receives a fixed score of −10,000, making it invisible to the selection operator. Only valid programs enter the makespan comparison. - The evaluator timeout (400 s, hard-coded in the polling loop) acts as a secondary gate: policies so inefficient that they cannot complete all 7 jobs within 400 s also receive a score of −10,000.
Initial policy
We used the best-performing schedule from the hand-crafted policy as the initial program fed to OpenEvolve. This choice served two purposes: it gave the LLM a strong, domain-informed baseline to begin exploring from, and it constrained the search to policies that are at least as good as the hand-crafted solution — any accepted evolved program must strictly outperform the hand-crafted makespan to score higher.
Concretely, the seed program is as follows:
node_a [1,2,3,4]: barnes(6T) -> freqmine(6T) -> blackscholes(4T)
node_a [5,6,7]: canneal(3T) -> radix(2T)
node_b [0,1,2,3]: streamcluster(4T) -> vips(4T)
Barnes and Freqmine were deliberately given more threads than cores to signal the LLM that even if the data in the prompt suggests that these are highly parallelizable jobs and can benefit from more threads, giving more threads than available cores is not the correct way to do it. The LLM will implicitly know this as it will receive the minimum score for this from the evaluator.
How the policy changed during evolution
Table 7 summarises the best valid makespan found at each iteration across both phases of the run.
| Iteration | Makespan (s) | Key structural change |
|---|---|---|
| 0 | Invalid | Seed program: correct topology but threads > cores |
| 1 | 260 | Constraint fixed; switched to a 5 + 2 core split on node-a |
| 2 | 254 | Minor thread-count refinement |
| 3 | 233 | Bold restructuring: vips moved to node-a, canneal to node-b |
| 6 | Invalid | Single-core serialisation hallucination (see below) |
| 10 | 219 | First breakthrough: reverted to 4 + 3 split with correct 4T counts; critical paths balanced |
| 11–14 | Invalid | LLM collapsed all 5 node-a jobs into one slot; iteration 11 also placed radix on node-b |
| 15 | 383 | Major regression: all five node-a jobs serialised in a single 7-core slot |
| 17–19 | 218–207 | Recovered 4 + 3 structure; Phase 1 best at 207 s |
| 21–27 | 232–198 | Phase 2 fine-tuning; global optimum reached at iteration 27 |
| 28 | Invalid | Two jobs (canneal, radix) omitted entirely (see below) |
| 29 | 198 | Global best reproduced |
| 33–34 | 328–339 | Late regression: LLM explored slot-consolidation strategies again |
| 35–40 | 200–294 | Plateau near 200 s with noisy exploration |
The evolution proceeded in three broad phases. In the constraint-fixing phase (iterations 0–2) the LLM’s primary task was eliminating the hard-constraint violation inherited from the seed; only after fixing thread counts did the score escape from −10,000. In the structural exploration phase (iterations 3–20) the model alternated between promising topological changes (the 4 + 3 core split at iteration 10) and disastrous over-consolidations (the 7-core single-slot policy at iteration 15). The high invalid rate during this phase (11 out of 20 iterations produced a constraint-violating program) reflects aggressive exploration. In the convergence phase (iterations 21–40) the model stabilised around the 4 + 3 topology, fine-tuning thread counts and job ordering until landing on the global best of 198 s at iteration 27.
The two SLO violations observed during the experiment (p95 latency > 1 ms) coincided with the cluster executing the heavily serialised single-slot policies in iterations 11–14. Even though core 0 on node-a remained isolated for memcached, running four or five jobs back-to-back on seven contiguous cores generated sustained LLC and memory-bandwidth pressure that briefly pushed p95 to 1.52 ms and 3.80 ms respectively. Once the policy converged to the balanced 4 + 3 structure in Phase 2, p95 remained below 765 µs across all subsequent monitoring intervals.
Why the AI-generated policy performs better or worse than the baseline
The AI-generated optimal policy was exactly the same as the baseline hand-written policy given to OpenEvolve as the initial program. The slightly increased makespan is likely due to noise in setup of gcloud as both these experiments were run on 2 different days on separate instantiations of the cluster.
Hallucinations and logical flaws
Single-core serialisation trap (iterations 6 and 14). At iteration 6 the model generated the following schedule:
node_a [1,2,3,4,5,6]: barnes(6T) -> freqmine(6T)
node_a [7]: canneal(1T) -> radix(1T) -> blackscholes(1T)
node_b [0,1,2,3]: streamcluster(4T) -> vips(4T)
The model’s apparent reasoning was that dedicating six cores to the two cache-intensive jobs (barnes, freqmine) would reduce LLC contention, with the three remaining jobs occupying the leftover single core. This schedule is structurally valid: all seven jobs are present, and no cores overlap. The validator accepted it without penalty.
The flaw is quantitative, not structural. According to the runtime table, canneal at 1 thread takes approximately 219 s. Adding radix at 1 thread (≈33 s) and blackscholes at 1 thread (≈64 s) sequentially yields a slot runtime of 219 + 33 + 64 = 316 s, which exceeded the 400-second evaluator deadline in practice, triggering a timeout. The model had generalised the heuristic “isolate sensitive jobs onto a wide slot” but failed to apply the quantitative consequence that serialising a 219-second job on a single core determines the critical path. The identical mistake recurred at iteration 14, indicating that the island population had retained the flawed program as a candidate parent across multiple generations before it was finally discarded.
Missing-jobs hallucination (iteration 28). A qualitatively different failure occurred at iteration 28. The model produced a syntactically correct Python program containing only five of the seven required jobs; canneal and radix were absent. The generated code included a well-formatted calculate_makespan() helper function and appeared complete at a glance. The validator caught the error immediately:
Invalid schedule:
Missing jobs: ['canneal', 'radix']
No cluster execution occurred and the program received score = −10,000.
Part 4: Dynamic scheduling on a single 4-core VM
Scaling memcached with threads and cores
Memcached performance depends on both the number of threads T and the number of CPU cores C. With T = 1 memcached saturates at approximately 65K QPS regardless of how many cores are allocated, because a single thread cannot utilize multiple cores. When T is increased to 2 or 3 threads and C is increased to 2 or 3 cores, memcached can sustain up to 125K QPS while keeping p95 latency near the 0.8 ms SLO. This demonstrates that both threads and cores must be scaled together to handle high QPS: adding cores without enough threads provides no benefit and adding threads without enough cores leaves them contending for CPU time. Three runs were averaged for each configuration, and error bars showing the standard deviation are included in the plot.
Threads and cores for the peak load of 125K QPS. T = 3, C = 3 is the only configuration that reliably sustains 125K QPS while keeping p95 latency below 0.8 ms. The other configurations either saturate before reaching 125K QPS (T = 1 with any C or T = 2, C = 1) or barely exceed the 0.8 ms SLO at peak load (T = 2, C = 3 marginally violates SLO at 125K).
Fixed number of threads with a dynamic number of cores. We propose T = 3 because:
- At low QPS (5K–65K) all configurations perform similarly and T = 3 incurs no penalty.
- At high QPS (110K–125K) T = 3 fully utilizes 3 cores when available, sustaining the SLO.
- If we used T = 1 or T = 2, even with 3 cores allocated dynamically, memcached would bottleneck above 65K or 110K QPS respectively, violating the SLO.
T = 3 ensures the system can take full advantage of additional cores when allocated dynamically during peak load.
Controller design
Memcached now shares one 4-core VM with the seven batch jobs, under a dynamic load trace that varies randomly between 5K and 110K QPS every 15 seconds. The controller must finish all batch jobs as soon as possible without violating the 0.8 ms p95 latency SLO, and it does not know the load trace in advance.
Overview of the scheduling policy
Heavy Slot: streamcluster -> vips -> freqmine
Light Slot: canneal -> barnes -> blackscholes -> radix
Our controller pins memcached to the lowest-numbered cores and gives the remaining cores to the batch jobs, dynamically adjusting the number of memcached cores between 1 and 3 based on its measured CPU utilization. It maintains at most one “heavy” batch job (streamcluster, vips, freqmine) and one “light” batch job (canneal, barnes, blackscholes, radix) at any time; when both are running, the heavy job always gets more cores than the light job. We use a utilization-based policy: if the average utilization of memcached’s cores exceeds a high threshold we increase its core allocation by one, and if it stays below a low threshold for several samples we shrink its core allocation by one, subject to the cap of 3 cores. By capping memcached at 3 cores, batch jobs always retain at least one dedicated core, avoiding the “pause everything” behavior. The heavy and light queues are ordered so that long, memory (and cache)-intensive jobs start early and shorter, less memory (and cache)-intensive jobs overlap with them, ensuring there is no strong interference to the heavy jobs (e.g. similar to the one created by running 2 heavy jobs in parallel). This minimizes the tail and gives a makespan of about 15 minutes with no SLO violations.
Cores for memcached
We monitor CPU utilization on the cores currently assigned to memcached once per second using psutil, and treat this utilization as a proxy for how close we are to violating the latency SLO. If the average utilization across memcached’s cores rises above a high threshold (80%) for at least one sample (this conservative choice is to ensure that there are no SLO violations), we increment the number of cores given to memcached by one, subject to a hard cap of 3 cores (so memcached can use cores 0–2 at most). If the utilization falls below a low threshold (40%) for several consecutive samples, we decrement the number of memcached cores by one, down to a minimum of 1 core. A short cooldown between changes prevents oscillations; combined with the two thresholds and hold times, this gives a stable reproducible behavior while still reacting quickly to load spikes. We cap memcached at 3 cores (0, 1, 2) so that core 3 is always reserved for batch work and we never reach a state where all batch jobs must be paused while memcached runs alone, which we found significantly improves makespan while maintaining SLO.
Cores for each batch job
We do not assign a fixed number of cores per batch job; instead, we classify jobs as heavy or light and always give all available batch cores to whichever jobs are running, subject to “heavy gets more than light” when they overlap. Let \(C_m\) be the current number of memcached cores (between 1 and 3) and \(C_b = 4 - C_m\) the number of batch cores; batch jobs always run on the highest-numbered cores. If only a heavy job is running, it gets all \(C_b\) batch cores, so long heaviest jobs can exploit up to 3 cores when memcached is light; this speeds up streamcluster, vips, and freqmine when they run alone. If a heavy and a light job run concurrently and \(C_b \ge 2\), the heavy job gets all but the last batch core and the light job gets the last one, so the heavy job progresses quickly while the light job makes steady progress on its own core. If both jobs are present but only one batch core is available, the heavy job gets that core and the light job is temporarily paused; we resume and re-expand the light job as soon as memcached shrinks back and more batch cores become available. Within this framework, we classify streamcluster, vips, and freqmine as heavy (they benefit most from multiple cores, take the most time to complete and parallelize well across cores; and cannot be run in parallel with each other as they heavily thrash different cache levels), whereas canneal, barnes, blackscholes, and radix are treated as light jobs that can safely live on a single core while a heavy job runs. Across the different combinations of pairings we explored this ordering gave us the best makespan with no SLO violations.
- barnes: Runs in the light slot. While a heavy job is present and \(C_b \ge 2\), barnes uses one dedicated batch core; once no heavy jobs remain it can use all remaining batch cores, which shortens its tail. We assign it to the light class because it is relatively short and does not justify stealing multiple cores from long heavy jobs.
- blackscholes: Also a light job. Blackscholes scales reasonably but is short enough that running it mostly on one core during the heavy phase is sufficient.
- canneal: Treated as a light job and often started at \(t = 0\) alongside streamcluster. It typically runs on one batch core while streamcluster and vips have priority, then expands to more cores once those finish. We deliberately restrict canneal to the light slot even though it takes relatively long time to run because it is memory-bound, limited by the memory latency and does not benefit as much as the heavy jobs from multiple simultaneous cores.
- freqmine: Runs in the heavy slot and gets as many batch cores as are available when it is the only heavy job, which can be up to 3 cores. When paired with a light job it still gets all but one batch core. We treat it as heavy because it is compute-bound and speeds up well with more cores. It is also the longest running job.
- radix: A light job that runs concurrently with the current heavy job on a single batch core whenever at least two batch cores are available; otherwise it is paused and resumed as memcached load allows. Like blackscholes, radix is short enough that giving it one core during the heavy phase is sufficient to hide its runtime under the longer jobs. It has in fact the shortest runtime among all jobs.
- streamcluster: The first heavy job; it starts immediately and is given as many batch cores as possible subject to memcached’s current needs (typically 2–3 cores). Because it is one of the longest, most memory intensive jobs, prioritizing its cores reduces the overall makespan.
- vips: The second heavy job, scheduled after streamcluster. It receives multiple cores when memcached load is low and otherwise shares batch cores with light jobs as described above. It finishes relatively fast but was still added to the heavy job slot to slightly balance the runtime of the heavy slot with the lighter slot, so both of them will finish at around the same time.
Threads per batch job
Each JobSpec stores three thread counts: a higher value when the job runs alone on at least two batch cores, a lower “paired” value when it shares batch cores with another batch job, and a conservative setting when it runs on a single core. At runtime, the controller chooses between these three values based on (i) how many batch cores are actually assigned to the job and (ii) whether another batch job is currently running in the other slot. This allows us to exploit parallelism when a job has multiple cores while avoiding over-using the CPU and creating unnecessary contention when two batch jobs share the batch cores.
- barnes: 3 threads when running alone with ≥ 2 cores; 2 threads when paired; 1 thread when on a single core. Barnes exhibits near-linear speedup up to 4 threads (N-body), so 3 threads on 2 cores gives good utilisation.
- blackscholes: Blackscholes is part of the light job slot. We capped it at 2 threads on multiple cores and 1 on a single core. Blackscholes is also not highly parallelizable as seen in experiments from Part 2. It also has a much smaller running time which is why giving it more cores (2 instead of 1 in the “paired” setting) did not give better marginal gains than allocating that core to one of the heavy jobs.
- canneal: Canneal is part of the light job slot. We capped it at 1 thread for both paired and isolated setting. This is because the PARSEC paper [1] characterizes canneal as memory-bound with irregular access and a very large working set. This is one of the long running jobs in the light slot. This was necessary to be executed in the light slot to balance the running time of the 2 slots and ensure maximum cpu utilization at all times.
- freqmine: Freqmine is part of the heavy job slot and is in fact the final job to end in the queue. We give it 2 cores for the paired setting while restricting it to 1 core in case more cores are not available. This is because it is highly parallelizable and a longer running job. Giving it maximum share of the core split allows executing it as fast as possible (maximum marginal latency gain).
- radix: Radix is part of the light job slot. It is the shortest running job. Thus we cap it at 1 core in the shared setting, as even though it is parallelizable, it does not give any marginal improvement (in fact harms the makespan as longer jobs would not get more cores in that case).
- streamcluster: Streamcluster is part of the heavy job slot and is also the second longest running job. It is also highly parallelizable with access to more cores, and is also memory-intensive. Thus we ran it in colocation with a lighter job (in terms of both memory and compute). We give it 2 cores in the paired setting as it ensures that it finishes in reasonable time. It is also capped at 1 core in case memcached load is very high.
- vips: Vips is part of the heavy job slot. It however runs fairly quickly. Vips is also highly parallelizable and thus given 2 cores in the paired setting.
Which jobs are colocated, and on which cores
There are 2 slots, namely heavy and light. We colocate one heavy job with one light job to ensure that the heavy job is not severely affected by the light job. We run the heavy jobs on cores 1–3 depending on the load from memcached while jobs in the light slot are executed on the remaining cores (sometimes even paused as the only core available is given to the heavy slot during high memcached load). The heavy slot includes streamcluster, freqmine, vips while the light slot includes radix, canneal, barnes, and blackscholes. The colocated jobs are listed in Table 8.
| Heavy slot | Light slot |
|---|---|
streamcluster | canneal |
vips | barnes |
freqmine | barnes |
freqmine | blackscholes |
freqmine | radix |
Order of the batch jobs
Order: streamcluster, canneal, vips, barnes, freqmine, blackscholes, radix.
The 7 jobs are run in parallel in 2 slots. Barnes is a resource intensive job and thus we wanted to achieve minimum overlap with both streamcluster and freqmine from the heavy slot. Thus it was scheduled accordingly. Canneal was the longest running job in the light slot and thus was started earliest in the light slot. Blackscholes and radix are scheduled in the light slot in decreasing order of running time. Streamcluster is a resource intensive job and thus was run earliest in the heavy slot along with canneal (which is relatively light). Vips was run in between freqmine and streamcluster to absorb the thrashing of different resources by barnes.
Differences from the policy in Part 3
Our policy takes inspiration from the policy used in Part 3 but there are fundamental differences in the available compute and thus it cannot be used as it is. One major difference is that Part 3 had 2 machines to run batch jobs (with one machine being highcpu). This allowed offloading the long-running heavy jobs on that machine as they were also impacted most by interference in different resources from other jobs. We used the same principle in Part 4 and did not run these heavy jobs in parallel together but are running them one after the other so their execution is not impacted due to resource thrashing from each other. In Part 3, we also use the slot-based execution and ensure that the different slots roughly end at the same time which allows maximum cpu utilization throughout (no cpu core is idle for long). We employ the same principle here as well and try our best to balance execution time between the heavy and light job slots. Though it is important to note that here it is much more difficult for the 2 slots to end at a similar time as the heavy slot can block the light slot in case of high memcached load (which was never the case in Part 3). Thus the policy in Part 4 has only 2 slots in contrast to 3 slots but most of the jobs which got 4 cores in Part 3 (streamcluster, vips and freqmine) are also in the heavy slot for Part 4 while some jobs which also had 4 cores in Part 3 are not in the heavy slot in Part 4 (barnes, blackscholes) as these have relatively much smaller execution time.
Implementation
The scheduling policy was implemented using dynamic CPU allotment and Docker container control mechanisms. Memcached CPU allocation was controlled using Linux taskset, while batch application placement was managed using Docker cpuset-cpus updates.
- Dynamic CPU partitioning: The scheduler divided the four available cores between memcached and batch jobs using the
cores_for()function. Memcached was capped at a maximum of three cores (MEM_CAP = 3) to ensure that at least one core always remained available for batch execution. - Updating memcached affinity: Memcached core assignments were updated dynamically using
sudo taskset -a -cp <cores> <pid>. The scheduler obtained the memcached PID usingpgrepand repinned the process whenever the policy changed the number of allocated cores. - Docker CPU-set updates: Batch jobs were executed inside Docker containers. Core assignments were modified at runtime using
docker update --cpuset-cpus=<cores> <container_id>. This allowed the scheduler to dynamically rebalance heavy and light workloads without restarting containers. - Container pausing and unpausing: When a job temporarily lost all assigned cores, the scheduler paused the container using
container.pause()and resumed execution later usingcontainer.unpause(). This prevented unnecessary contention when only a single batch core was available. - Load-aware adaptation: CPU utilization on memcached cores was sampled periodically using
psutil. If utilization exceeded theGROW_HIthreshold, an additional core was allocated to memcached. If utilization remained below theSHRINK_LOthreshold for several intervals, a core was reclaimed for batch jobs. - Heavy/light job queues: Applications were separated into heavy and light queues. At most one heavy and one light job executed concurrently. The scheduler dynamically split available batch cores between them, typically assigning more cores to heavy workloads while reserving one core for lighter jobs.
- Thread-level tuning: Different applications were launched with customized thread counts depending on whether they executed alone or concurrently. For example,
cannealwas limited to fewer threads due to poor scalability, whilevipswas allowed more threads because it scaled efficiently. - After all batch jobs finish, memcached is repinned to cores [0, 1, 2, 3] via taskset so it can serve the remainder of the mcperf trace. Scheduling events are recorded with
SchedulerLoggerintolog*.txt.
Second-best policy
The second-best policy we got is:
Heavy Slot: streamcluster -> freqmine -> barnes
Light Slot: blackscholes -> radix -> vips -> canneal
This policy gave a makespan of 17 minutes which is slightly more than 2 minutes longer than the best performing policy. The main difference between the 2 policies is barnes and vips being swapped between the heavy and light slots. In this policy, the light slot ends after the heavy slot which indicates that some of the cores were left idle towards the end of the run for this policy. We thus swapped the 2 jobs to increase the running time of the heavy slot to ensure most of the cores are kept busy for as long as possible in the total makespan. Also this policy runs canneal which is a very long running job at the end of the light slot with freqmine which is also memory-intensive, we changed that order. By moving Barnes out of the heavy slot and into the light slot, the heavy queue (Streamcluster → Vips → Freqmine) benefits from Vips being a shorter, faster job, it completes quickly, allowing Freqmine to start earlier and claim a wide, uncontested scheduling window across Cores 1–3.
Results
We ran the workflow 3 separate times on the dynamic load trace with a fixed random seed.
| Job | Mean time [s] | Std [s] |
|---|---|---|
| barnes | 188.5 | 10.1 |
| blackscholes | 109.8 | 12.6 |
| canneal | 297.3 | 7.0 |
| freqmine | 417.0 | 88.1 |
| radix | 43.6 | 0.7 |
| streamcluster | 370.7 | 5.5 |
| vips | 94.9 | 17.2 |
| Total time | 882.9 | 80.3 |
Across the three runs, the mean SLO violation ratio is 0.00 with standard deviation 0.00.
Faster load changes: a 5-second interval
With the 5 s qps_interval, load changes roughly three times as often as in our runs above (15 s interval). The controller still finishes all batch jobs in about the same makespan (~15–16 min), but it reacts more often to spikes: more memcached core grows/shrinks and more light-job pauses. That lag shows up as SLO violations (~14%) on the 5 s trace, whereas the runs with the 15 s interval had 0% violations. At an 8 s interval and above, the violation rate drops below 3% while keeping a similar makespan.
SLO violation ratio with the 5-second interval: 14.13% (26 violating intervals out of 184 in the batch window).
Smallest interval that keeps SLO violations under 3%: a qps_interval of 8 s gives 2.94% SLO violations and 7 s gives 9.52%. Hence the smallest qps_interval that we can use is 8 s.
Reasoning. Our controller samples memcached CPU utilization every 1 s (POLL_INTERVAL), needs ≥ 80% utilization for 1 sample to grow cores (GROW_HI, GROW_HOLD = 1), and waits ≥ 4 samples below 40% to shrink (SHRINK_LO, SHRINK_HOLD = 4), with a 2 s cooldown (COOLDOWN_S) between changes. Memcached is also capped at 3 cores (MEM_CAP = 3), so at high QPS it may need a grow right as batch jobs are competing for core 3.
With a 5 s or 7 s qps_interval trace, the QPS can jump by tens of thousands of requests before the controller finishes growing and repinning memcached, rebalancing batch jobs, and sometimes pausing the light job. These additional transitions are visible in the logs (e.g., 135 grow/shrink events and 36 pauses at 5 s, compared to 67 and 12 at 15 s). An 8 s interval provides enough time for at least one complete poll–decide–apply cycle (and often a second) before the next large QPS increase, allowing memcached to receive additional cores before the p95 latency exceeds 0.8 ms. Intervals ≤ 7 s outpace this control loop, whereas intervals ≥ 8 s keep the batch-window violation ratio below 3% in our experiments.
References
[1] C. Bienia, S. Kumar, J. P. Singh, and K. Li, “The PARSEC benchmark suite: Characterization and architectural implications,” in Proceedings of the 17th International Conference on Parallel Architectures and Compilation Techniques (PACT), pp. 72–81, 2008.