How cache_aware picks a server A decision flow. First the gateway tests whether loads are imbalanced: the busiest minus the lightest is more than 64 and the busiest is more than 1.5 times the lightest. If yes, the request goes to the least-loaded server. If no, the gateway computes the match rate against its character tree. Above 0.3 the request goes to the server with the longest match. At 0.3 or below it goes to the least-loaded server. Every outcome inserts the request text into the tree. request text imbalanced? max - min > 64 and max > 1.5 x min match rate > 0.3? matched characters / request characters least-loaded server longest match server in the tree least-loaded random among ties yes no yes no step 1 step 2 step 3 every outcome inserts the request text under the chosen server