Tag Info

Hot answers tagged

45

You probably want to see the PHP Client Comparison. Short version: They will both work, and for most cases either one will do just fine. Regarding the other issue: Yes, you should be able to do telnet 127.0.0.1 11211. Very few firewalls would block localhost from communicating with itself. If you are not able to connect, verify that memcached really is ...


29

Disclaimer: You'd be mad to listen to me without doing a tonne of testing AND getting a 2nd opinion from someone qualified - I'm new to this game. The efficiency improvement idea proposed in this question won't work. The main mistake that I made was to think that the order that the memcached stores are defined in the pool dictates some kind of priority. ...


21

As Nate's link suggests, both work perfectly well for simple usage. However, memcached supports more features that allow you to get the most performance out of memcached. The binary protocol reduces the amount of data required to be sent between client and server. Multigets and multisets allow you to get/set multiple items at the same time. If you're finding ...


21

The products you list serve different purposes. OPCode caches There are many PHP Accelerators (OPCaches) as seen on this Wikipedia list. As is common with open source products, they are all fairly similar. XCache is the lighttp PHP accelerator, and is the default choice when you are running that HTTPd. It works well with Apache as well, however APC ...


19

The short answer: Either one is what you are looking for, but my first choice would be memcache (the first one you listed), purely based on its correct use of nomenclature. Now here's how I came to that conclusion: Here is a quick backgrounder in naming conventions (for those unfamiliar), which explains the frustration by the question asker: For many *nix ...


16

This means the service was running at one time, but has crashed. When you start a service, it creates a "lock" file to indicate that the service is running. This helps avoid multiple instances of the service. When you stop a service, this lock file is removed. When a running service crashes, the lock file exists but the process no longer exists. Thus, ...


16

Re: Tip 3 above (for anyone else who happens to come across this via google), it seems that at least presently in order for this to work you must use memcache.session_redundancy = N+1 for N servers in your pool, at least that seems to be the minimum threshold value that works. (Tested with php 5.3.3 on debian stable, pecl memcache 3.0.6, two memcached ...


15

The older, buggier one is called php-memcache because that seemed the most appropriate name. The newer, better version independently developed by the folks at Digg was instead named php-memcached in the interest of disambiguation. People who would recommend you pick one over the other based solely on the correctness of the name really have no business ...


10

First, decide if you need memcached. APC is both an "accelerator" (an opcode cache, which is fairly transparent), and a caching solution (provides an in-memory data store that code needs to write/read from). memcache only does the latter. The only reason you'd typically need memcached is if you're going to be running multiple servers that need to ...


10

I use Ubuntu, and Debian mostly, so this answer is based on those, but I suspect the answer for other distros is largely the same. In /etc/memcached.conf -- If it's not in exactly the same place, a) I'd be surprised, and b) you could find it with locate # Start with a cap of 64 megs of memory. It's reasonable, and the daemon default # Note that the ...


10

Here are options which I found: 1- Memcached 2- Varnish 3- Apache mod_cache Caveats: Do you know why your load is so high? If the load is caused by high CPU load required to generate dynamic content, and you're able to serve that content from a cache, than a caching solution may help you. But if the load is caused by i/o contention, or if you're ...


10

Use the the MEMORY storage engine on a read only slave to do your reads from, is exactly what you really want and a sane setup. Forget "dumping it to disk" (?!) or other strange things. You can even put the slave as another instance on your existing server if you can't afford to setup a dedicated slave, but properly tuning the MySQL parameters for mostly ...


8

You've pretty much got the answer to your first question already: the intent of ADD is to only work when a key doesn't already exist, while SET is there to update the value, regardless of whether it already exists. If you're familiar with SQL, it's (roughly) like the difference between INSERT queries (ADD) and UPDATE (SET). In regards to your addendum ...


8

Settings are maintained here.. /etc/sysconfig/memcached Change # set ram size to 2048 - 2GiB CACHESIZE="4096" Type the following command: memcached-tool IP_ADDRESS:Port memcached-tool 127.0.0.1:11211 display memcached-tool 127.0.0.1:11211 stats


7

Memecache library is responsible for sending the request to the correct server. The library uses the list you provide to send requests to different servers and memcache doesn't do replication. Refer to the Linux journal article. It explains how memcache works in more detail. http://www.linuxjournal.com/article/7451?page=0,1


7

Go to the memcached web page; copy the download link; then in a terminal, wget http://memcached.googlecode.com/files/memcached-1.4.1.tar.gz tar xzf memcached-1.4.1.tar.gz cd memcached-1.4.1 ./configure && make && sudo make install Those are generally the basic steps you do when installing Linux software manually, and it doesn't look like memcached is ...


7

If it is a small website, I do think this level of optimization is overkill. But there is one way to find out for sure: test it. We have used WCAT in the past to answer questions like this in the past. It's a great tool for seeing how the site will perform under various loads. JMeter is another great tool for something like this. Using WCAT, for example, ...


7

Make an effort, 1 minute of Googling would give you the answer. In no particular order, you could use: Xinetd Rinetd IPTables SSH tunnel Netcat Layer 4-7 balancing (eg haproxy) Or do a simple grep for localhost and replace it with a hostname that you can change. iptables sysctl -w net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING -j MASQUERADE ...


6

If (and that's a very big if) I'm going to deploy a Mac OS X Server in production, installing all of Xcode just to get memcached doesn't make a whole lot of sense, if there's an easy way to just get the components I need. As a system administrator, I want only the components I need to deploy the application/service that the server is supposed to be running, ...


6

You probably have a very large number of very small objects. Typically, the smallest slab holds 104-byte entries. If you have a lot of entries that just map one integer to another, you can get waste as high as 85%. You can find information on how to tune around this in the article Memcached for small objects.


6

You have almost certainly mistakenly excluded some packages with yum's exclude option in your yum.conf or a file which it includes. For instance you may have: exclude=php* This would prevent any package whose name begins with PHP from ever being shown to you. To fix the problem, remove the exclusion from your yum configuration. (This was probably done ...


6

You really should use a cache server in front of your web servers. I recommend Varnish-cache. We use it at work with the largest and busiest website in scandinavia. We replaced 13 highly loaded squid boxes with 1 varnish box, and 1 for spare. I did a simple ab benchmarking on my private website, and it went from 9 requests a sec to over 2000. You decide ...


6

A good answer was posted on stackoverflow which answers your question nicely. http://stackoverflow.com/questions/28716/which-php-opcode-cacher-should-i-use-to-improve-performance


6

Guys, here's the correct answer: http://about.digg.com/blog/new-pecl-extension-libmemcached-released @Bill Getas: Easy on the arrogance. As it happens, Andrei is more than likely a little smarter than you are.


6

The short answer to your question is: It's not. Distributed memcached makes sense where your system is able to retrieve valid answers from cache, rather than having do expensive lookups/computation to get the correct answer. In the case of memcached, talking across the internet with latencies of maybe 60-100ms or more, there is really nothing to be gained. ...


5

memcflush in the memcache tools is what you want: memcflush --servers=localhost:11211 Change localhost to whatever your server is. The memcache tools may not be installed on the server, if you're running a Debian-based OS you can install it like this: sudo apt-get install libmemcached-tools


5

If your autoscaling instances can be terminated at any time and you can't afford to lose session information, then you can't store session information on the autoscaling instances. If you have a database (e.g., MySQL, RDS) you could store sessions there. This works ok for lower to medium volume web sites, but can break with higher volume. You could run ...


5

# memcached -u memcached -d -m 30 -l 127.0.0.1 -p 11211 You'll notice there is "-l 127.0.0.1" in your command line. This tells memcached to only listen on the lo interface. If you want to access it from a remote machine, you need to remove this part of the command line.


5

I believe the socket will need to be world executable, not writable. If your seeing a PHP notice message containing errno=32 Broken pipe, adjust Memcached access mask to 0755 -s /path/to/memcache.socket -a 0755 Also verify that Drupal's Memcached daemon has TCP port of 0 in the configuration. An unset port will default to 11211, and confuse the socket ...


5

IMHO this is not a question of "memcache vs varnish", but "varnish with or without memcache", and I think you should by all means use memcache whenever you can. In fact, memcache/memcached cahes data and objects from a database, whilst Varnish is an HTTP accelerator for "content-heavy dynamic websites". Both work together really well, and for example a ...



Only top voted, non community-wiki answers of a minimum length are eligible