best practice with memcache/php - multi memcache nodes The 2019 Stack Overflow Developer Survey Results Are InMultiple AWS EC2 running Auto Scaling and Distributed MemcacheSetting up memcached/memcache with Php on Ubuntu 10.10Memcache - Issues in a distributed environment with many nodesDistributing php-session load on a memcache arrayMemcache+PHP session tuning: How does memcache expire keys?m1.small nodes for memcache array on AWS EC2How to install memcache (to ease mysql load) in phpPHP Memcache module is compiling with different module (debian)PHP + Mysql and memcache or phpsessionsInstall memcache php ext on php 5.6PHP 7.2 Failed to read session data: memcache
Why do UK politicians seemingly ignore opinion polls on Brexit?
Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?
Delete all lines which don't have n characters before delimiter
What do hard-Brexiteers want with respect to the Irish border?
Building a conditional check constraint
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
Is three citations per paragraph excessive for undergraduate research paper?
Time travel alters history but people keep saying nothing's changed
Did 3000BC Egyptians use meteoric iron weapons?
Right tool to dig six foot holes?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Where to refill my bottle in India?
Scaling a graph of a circle and the standard parabola in TikZ
One word riddle: Vowel in the middle
The difference between dialogue marks
Is this app Icon Browser Safe/Legit?
Pokemon Turn Based battle (Python)
Are there any other methods to apply to solving simultaneous equations?
Can a flute soloist sit?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Statement true because not provable
Have you ever entered Singapore using a different passport or name?
How technical should a Scrum Master be to effectively remove impediments?
best practice with memcache/php - multi memcache nodes
The 2019 Stack Overflow Developer Survey Results Are InMultiple AWS EC2 running Auto Scaling and Distributed MemcacheSetting up memcached/memcache with Php on Ubuntu 10.10Memcache - Issues in a distributed environment with many nodesDistributing php-session load on a memcache arrayMemcache+PHP session tuning: How does memcache expire keys?m1.small nodes for memcache array on AWS EC2How to install memcache (to ease mysql load) in phpPHP Memcache module is compiling with different module (debian)PHP + Mysql and memcache or phpsessionsInstall memcache php ext on php 5.6PHP 7.2 Failed to read session data: memcache
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
So I am working on a web app - that has to be built for scalability. It stores frequent MySQL querys into the cache. I have pretty much everything built and ready to go - but I am concerned on best practices on handling where to cache the data. I've talked to a few people and one of them suggested to split each key/value across all the memcache nodes.
Meaning if i store the example:
'somekey','this is the value'
it will be split across lets say 3 memcache servers.
Is that a better way? or is memcache more built on a 1 to 1 relationship?. For example.
store value on server A till it faults out - go to server B and store there.
that is my current understanding from the research I have done and past experience working with memcache.
Could someone please point me in the right direction in this and let me know which way is best or if I completely have this mixxed up.
Thanks
php scalability memcache
add a comment |
So I am working on a web app - that has to be built for scalability. It stores frequent MySQL querys into the cache. I have pretty much everything built and ready to go - but I am concerned on best practices on handling where to cache the data. I've talked to a few people and one of them suggested to split each key/value across all the memcache nodes.
Meaning if i store the example:
'somekey','this is the value'
it will be split across lets say 3 memcache servers.
Is that a better way? or is memcache more built on a 1 to 1 relationship?. For example.
store value on server A till it faults out - go to server B and store there.
that is my current understanding from the research I have done and past experience working with memcache.
Could someone please point me in the right direction in this and let me know which way is best or if I completely have this mixxed up.
Thanks
php scalability memcache
add a comment |
So I am working on a web app - that has to be built for scalability. It stores frequent MySQL querys into the cache. I have pretty much everything built and ready to go - but I am concerned on best practices on handling where to cache the data. I've talked to a few people and one of them suggested to split each key/value across all the memcache nodes.
Meaning if i store the example:
'somekey','this is the value'
it will be split across lets say 3 memcache servers.
Is that a better way? or is memcache more built on a 1 to 1 relationship?. For example.
store value on server A till it faults out - go to server B and store there.
that is my current understanding from the research I have done and past experience working with memcache.
Could someone please point me in the right direction in this and let me know which way is best or if I completely have this mixxed up.
Thanks
php scalability memcache
So I am working on a web app - that has to be built for scalability. It stores frequent MySQL querys into the cache. I have pretty much everything built and ready to go - but I am concerned on best practices on handling where to cache the data. I've talked to a few people and one of them suggested to split each key/value across all the memcache nodes.
Meaning if i store the example:
'somekey','this is the value'
it will be split across lets say 3 memcache servers.
Is that a better way? or is memcache more built on a 1 to 1 relationship?. For example.
store value on server A till it faults out - go to server B and store there.
that is my current understanding from the research I have done and past experience working with memcache.
Could someone please point me in the right direction in this and let me know which way is best or if I completely have this mixxed up.
Thanks
php scalability memcache
php scalability memcache
asked Dec 7 '10 at 15:57
user62835
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Nearly all of the "distributed" part of memcached is handled on the client side.
If you have multiple memcached servers defined in your config (I see the php tag on your post, so I'm guessing you're using pecl/memcache, but I think the syntax is similar for pecl/memcached)
<?php
$mc = new Memcache()
$mc->addServer('node1', 11211);
$mc->addServer('node2', 11211);
$mc->addServer('node3', 11211);
?>
the client will determine which server to put the data in using a hash of the key. There's an option of the addServer method (retry_interval = -1) where if a memcached server goes down, your PHP will not continue to try it.
There is some information about how you can do "replication" in Memcache, but from my experience, it's not really worth the effort or the "wasted" memory (you'd have to store all caches on all servers, where if you just use the built-in distribution mechanism, it'll just have to be stored on one. Obviously, if one of your servers die, you're going to get cache misses until that data is stored on another server, but you shouldn't be using Memcache as a persistent store, anyway). The Memcache client protocol is pretty smart. ;)
Original link to https://blogs.oracle.com/trond/entry/replicate_your_keys_to_multiple removed as it no longer exists.
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f210013%2fbest-practice-with-memcache-php-multi-memcache-nodes%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Nearly all of the "distributed" part of memcached is handled on the client side.
If you have multiple memcached servers defined in your config (I see the php tag on your post, so I'm guessing you're using pecl/memcache, but I think the syntax is similar for pecl/memcached)
<?php
$mc = new Memcache()
$mc->addServer('node1', 11211);
$mc->addServer('node2', 11211);
$mc->addServer('node3', 11211);
?>
the client will determine which server to put the data in using a hash of the key. There's an option of the addServer method (retry_interval = -1) where if a memcached server goes down, your PHP will not continue to try it.
There is some information about how you can do "replication" in Memcache, but from my experience, it's not really worth the effort or the "wasted" memory (you'd have to store all caches on all servers, where if you just use the built-in distribution mechanism, it'll just have to be stored on one. Obviously, if one of your servers die, you're going to get cache misses until that data is stored on another server, but you shouldn't be using Memcache as a persistent store, anyway). The Memcache client protocol is pretty smart. ;)
Original link to https://blogs.oracle.com/trond/entry/replicate_your_keys_to_multiple removed as it no longer exists.
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
add a comment |
Nearly all of the "distributed" part of memcached is handled on the client side.
If you have multiple memcached servers defined in your config (I see the php tag on your post, so I'm guessing you're using pecl/memcache, but I think the syntax is similar for pecl/memcached)
<?php
$mc = new Memcache()
$mc->addServer('node1', 11211);
$mc->addServer('node2', 11211);
$mc->addServer('node3', 11211);
?>
the client will determine which server to put the data in using a hash of the key. There's an option of the addServer method (retry_interval = -1) where if a memcached server goes down, your PHP will not continue to try it.
There is some information about how you can do "replication" in Memcache, but from my experience, it's not really worth the effort or the "wasted" memory (you'd have to store all caches on all servers, where if you just use the built-in distribution mechanism, it'll just have to be stored on one. Obviously, if one of your servers die, you're going to get cache misses until that data is stored on another server, but you shouldn't be using Memcache as a persistent store, anyway). The Memcache client protocol is pretty smart. ;)
Original link to https://blogs.oracle.com/trond/entry/replicate_your_keys_to_multiple removed as it no longer exists.
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
add a comment |
Nearly all of the "distributed" part of memcached is handled on the client side.
If you have multiple memcached servers defined in your config (I see the php tag on your post, so I'm guessing you're using pecl/memcache, but I think the syntax is similar for pecl/memcached)
<?php
$mc = new Memcache()
$mc->addServer('node1', 11211);
$mc->addServer('node2', 11211);
$mc->addServer('node3', 11211);
?>
the client will determine which server to put the data in using a hash of the key. There's an option of the addServer method (retry_interval = -1) where if a memcached server goes down, your PHP will not continue to try it.
There is some information about how you can do "replication" in Memcache, but from my experience, it's not really worth the effort or the "wasted" memory (you'd have to store all caches on all servers, where if you just use the built-in distribution mechanism, it'll just have to be stored on one. Obviously, if one of your servers die, you're going to get cache misses until that data is stored on another server, but you shouldn't be using Memcache as a persistent store, anyway). The Memcache client protocol is pretty smart. ;)
Original link to https://blogs.oracle.com/trond/entry/replicate_your_keys_to_multiple removed as it no longer exists.
Nearly all of the "distributed" part of memcached is handled on the client side.
If you have multiple memcached servers defined in your config (I see the php tag on your post, so I'm guessing you're using pecl/memcache, but I think the syntax is similar for pecl/memcached)
<?php
$mc = new Memcache()
$mc->addServer('node1', 11211);
$mc->addServer('node2', 11211);
$mc->addServer('node3', 11211);
?>
the client will determine which server to put the data in using a hash of the key. There's an option of the addServer method (retry_interval = -1) where if a memcached server goes down, your PHP will not continue to try it.
There is some information about how you can do "replication" in Memcache, but from my experience, it's not really worth the effort or the "wasted" memory (you'd have to store all caches on all servers, where if you just use the built-in distribution mechanism, it'll just have to be stored on one. Obviously, if one of your servers die, you're going to get cache misses until that data is stored on another server, but you shouldn't be using Memcache as a persistent store, anyway). The Memcache client protocol is pretty smart. ;)
Original link to https://blogs.oracle.com/trond/entry/replicate_your_keys_to_multiple removed as it no longer exists.
edited Sep 3 '12 at 15:26
Iain
105k14164258
105k14164258
answered Dec 7 '10 at 17:28
bhambybhamby
233110
233110
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
add a comment |
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
Since I can't post more than one link, pecl/memcache: pecl.php.net/package/memcache
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
pecl/memcached: pecl.php.net/package/memcached
– bhamby
Dec 7 '10 at 17:29
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f210013%2fbest-practice-with-memcache-php-multi-memcache-nodes%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown