<p>We have set up a kubernetes cluster for our laravel application on google cloud platform.
Containers:</p>

<ul>
<li>application code + php-fpm</li>
<li>apache2</li>
<li>others not related to the issue</li>
</ul>

<p>(We run under nginx-ingress-controller but this seems unrelated to the issue)</p>

<p>We run a jmeter stress tests on a simple laravel route that returns "ok" and we noticed terrible  response times.</p>

<p><a href="https://i.stack.imgur.com/l8fNm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l8fNm.png" alt="enter image description here"></a></p>

<p>Afterwards we run the same test on an index2.php (inside public dir το slide over the framework) which just returns 'ok'. </p>

<p>And we got this result(!):
<a href="https://i.stack.imgur.com/r30Gr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r30Gr.png" alt="enter image description here"></a></p>

<p>After digging we found out that the composer's autoloading stuff cause this slowness.</p>

<p>Any advice on how this could be resolved will be highly appreciated.</p>

<p>Thanks</p>

Tania Petsouka
<p>Ok. We found out that we had no opcache enabled.
As documented about composer optimize-autoloader:</p>

<blockquote>
  <p>On PHP 5.6+, the class map is also cached in opcache which improves the initialization time greatly. If you make sure <em>opcache is enabled</em>, then the class map should load almost instantly and then class loading is fast.</p>
</blockquote>
