@@ -36,7 +36,7 @@ Your cache backend should look something like this::
3636 CACHES = {
3737 'default': {
3838 'BACKEND': 'django_elasticache.memcached.ElastiCache',
39- 'LOCATION': 'cache-c.drtgf .cfg.use1.cache.amazonaws.com:11211',
39+ 'LOCATION': 'cache-c.draaaf .cfg.use1.cache.amazonaws.com:11211',
4040 }
4141 }
4242
5151
5252Django-elasticache changes default pylibmc params to increase performance.
5353
54+ Another solutions
55+ -----------------
56+
57+ ElastiCache provides memcached interface so there are three solution of using it:
58+
59+ 1. Memcached configured with location = Configuration Endpoint. In this case your application
60+ will randomly connect to nodes in cluster and cache will be used with not optimal
61+ way. At some moment you will be connected to first node and set item. Minute later
62+ you will be connected to another node and will not able to get this item.
63+
64+
65+ ::
66+
67+ CACHES = {
68+ 'default': {
69+ 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
70+ 'LOCATION': 'cache.gasdbp.cfg.use1.cache.amazonaws.com:11211',
71+ }
72+ }
73+
74+ ::
75+
76+
77+ 2. Memcached configured with all nodes. It will work fine, memcache client will
78+ separate items between all nodes and will balance loading on client side. You will
79+ have problems only after adding new nodes or delete old nodes. In this case you should
80+ add new nodes manually and don't forget update your app after all changes on AWS.
81+
82+ ::
83+
84+ CACHES = {
85+ 'default': {
86+ 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
87+ 'LOCATION': [
88+ 'cache.gqasdbp.0001.use1.cache.amazonaws.com:11211',
89+ 'cache.gqasdbp.0002.use1.cache.amazonaws.com:11211',
90+ ]
91+ }
92+ }
93+
94+ ::
95+
96+
97+ 3. Use django-elasticache. It will connect to cluster and retrieve ip addresses
98+ of all nodes and configure memcached to use all nodes.
99+
100+
101+ ::
102+
103+ CACHES = {
104+ 'default': {
105+ 'BACKEND': 'django_elasticache.memcached.ElastiCache',
106+ 'LOCATION': 'cache-c.draaaf.cfg.use1.cache.amazonaws.com:11211',
107+ }
108+ }
109+
110+ ::
111+
112+
113+ Difference between setup with nodes list (django-elasticache) and
114+ connection to only one configuration Endpoint (using dns routing) you can see on
115+ this graph:
116+
117+ .. image :: asd
54118
55119Testing
56120-------
0 commit comments