While running a website hosted into two app servers via load balancer, suddenly one app server stopped working and got hang. From the other app server access log found 499 status and also load average was high. About 20 minutes later, it started giving 200 status. And then, when the other app server completely rebooted, it also started working fine.
I didn't understand why suddenly this happened. From the error log, I found the below issue:
2019/11/03 12:43:19 [error] 26445#0: *30538354 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 47264368 bytes) in /.........../sites/all/modules/contrib/memcache/dmemcache.inc on line 64" while reading response header from upstream, client: ............, server: .........., request: "................", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "...........", referrer: "..........."
Now, what I need to do to fix the issue, so that it will never occur in future ?