<p>I've included more detail below, but the question I'm trying to answer is in the title. I'm currently trying to figure this out, but thought I'd ask here first in case anyone knows the answer off-hand.</p>

<p><strong>About my setup</strong></p>

<p>I have a Kubernetes service running on a Google Compute Engine cluster (started via Google Container Engine). It consists of a service (for the front-end stable IP), a replication controller, and pods running a Python server. The server is a Python gRPC server sleep-listening on a port.</p>

<p>There are 2 pods (2 replicas specified in the replication controller), one rc, one service, and 4 GCE instances (set to autoscale up to 5 based on CPU). </p>

<p>I'd like the service to be able to handle an arbitrary number of clients that want to stream information. However, I'm currently seeing that the service only talks to 16 of the clients. </p>

<p>I'm hypothesizing that the number of connections is either limited by the number of GCE instances I have, or by the number of pods. I'll be doing experiments to see how changing these numbers affects things. </p>

<p>Figured it out:</p>

<ul>
<li>It's not the number of GCE instances: I increased the number of GCE instances with no change in the number of streaming clients. </li>
<li><strong>It's the number of pods</strong>: each pod apparently can handle 8 connections. I simply scaled my replication controller with <code>kubernetes scale rc &lt;rc-name&gt; --replicas=3</code> to support 24 clients. </li>
</ul>

<p>I'll be looking into autoscaling (with a horizontal pod scaler?) the number of pods based on incoming HTTP requests.</p>

<p><strong>Update 1:</strong></p>

<p>Kubernetes <a href="http://kubernetes.io/v1.1/docs/design/horizontal-pod-autoscaler.html#next-steps" rel="nofollow">doesn't currently support</a> horizontal pod scaling based on HTTP.</p>

<p><strong>Update 2:</strong></p>

<p>Apparently there are other things at play here, like the size of the thread pool available to the server. With N threads and P pods, I'm able to maintain P*N open channels. This works particularly well for me because my clients only need to poll the server once every few seconds, and they sleep when inactive. </p>
