Recently I just started using AWS ElastiCache for a Laravel application. The application is running on 2 instances behind a ELB and handles about 6-10 request/second. Everything was going fine when I launched the application but then I started to receiving connection errors to the application with high latency and timeouts. The error messages was as follows:
[2016-05-17 07:28:25] production.ERROR: exception 'RuntimeException' with message 'Could not establish Memcached connection.' in /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:38 Stack trace:
#0/srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(164): Illuminate\Cache\MemcachedConnector->connect(Array)
#1 /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(102): Illuminate\Cache\CacheManager->createMemcachedDriver(Array) #2 /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(77): Illuminate\Cache\CacheManager->resolve('memcached')...
For my setup I'am using:
- Laravel 5.2
- AWS ElastiCache t2.small
- php5-memcached module libmemcached 1.0.18
To solve my issue for the time being I have installed memcached on a separate EC2 instance and have had no issues.
My question is, do I need to use AWS ElastiCache PHP Client instead of the php5-memcached to use Elasticache? I was under the impression that Elasticache was a drop in replacement for Memcached and could be used with out a problem.
Thank you for the help!