title: AWS ElasticBeanstalk periodically goes down
body: <p>I noticed lately that my laravel project in an AWS Elasticbeanstalk setup has been acting strangely. The server would go down in a few minutes. In a t3.small, it goes down in every 50 minutes. The health tab says that the memory is exhausted or something. It will go "Severe" for about 5-10 minutes then goes back without me doing anything. Basically just a whole zigzag in the monitoring. In the t3.nano it goes down at approximately every 5 minutes.</p>
  
  <p>Here are some things that I've done that I <strong>suspect</strong> to be the cause</p>
  
  <ul>
  <li>I've re-enabled pusher for broadcasting. The project has a pusher setup before and it was working fine. However, I disabled (removed all parts that uses it) as I don't need it yet. I re-enabled it and the problem occured</li>
  <li>I've played with AWS WAF and Cloudfront. So I was studying those two parts before and played with some settings, however, I can't remember using any of them related to my EBS application. I did removed everything I've added on WAF and Cloudfront.</li>
  </ul>
  
  <p>Here are some facts:</p>
  
  <ul>
  <li>Whenever I remove the container commands creating the schedule:run and queue:work, it becomes completely fine. Totally "OK" status even
  if I simulate sending hundreds of requests per second.</li>
  <li>I tried scaling it to 3 instances and the result is still the same, however, the downtime just becomes slower</li>
  <li>It gives a 503 error code whenever it's down</li>
  <li>The setup for EBS is PHP 7.2 running on 64bit Amazon Linux/2.8.4</li>
  <li>I'm testing the job and queue by sending 1 Pusher message every minute. It doesn't do anything except send the current time. This is
  also the only cronjob running.</li>
  <li>The cronjob works and I can also receive the Pusher messages, except during downtime</li>
  </ul>
  
  <p><strong>Here's an observation that I had with the logs</strong>
  - There's an "internal dummy connection" related to Apache. The time when it is logged is identical to the time that the downtime occurs.</p>
  
  <p>I've tried every hint on the logs, from juggling different settings on the cronjob and other possible causes. I've also tried asking my peers but no one has encountered such error before. In fact, they tested my cronjob and it's working properly for them.</p>
  
  <p>I also have this error in the /var/log/httpd/error_log</p>
  
  <p><code>[Fri Nov 23 19:07:35.208657 2018] [suexec:notice] [pid 3142] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
  [Fri Nov 23 19:07:35.228633 2018] [http2:warn] [pid 3142] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
  [Fri Nov 23 19:07:35.228644 2018] [http2:warn] [pid 3142] AH02951: mod_ssl does not seem to be enabled
  [Fri Nov 23 19:07:35.229188 2018] [lbmethod_heartbeat:notice] [pid 3142] AH02282: No slotmem from mod_heartmonitor
  [Fri Nov 23 19:07:35.267841 2018] [mpm_prefork:notice] [pid 3142] AH00163: Apache/2.4.34 (Amazon) configured -- resuming normal operations
  [Fri Nov 23 19:07:35.267860 2018] [core:notice] [pid 3142] AH00094: Command line: '/usr/sbin/httpd -D FOR</code></p>