Tag Info

Hot answers tagged

48

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 ...


32

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. ...


31

yes. you can clear the memcache. try: telnet localhost 11211 flush_all quit if the memcache does not run on localhost 11211, you will have to adjust it.


26

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, ...


25

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 ...


23

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 ...


20

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 ...


20

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 ...


16

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 ...


16

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 ...


13

Modify the OPTIONS line in /etc/sysconfig/memcached adding ">> /var/log/memcached 2>&1" on the end. IE OPTIONS="-vv >> /var/log/memcached 2>&1"


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

This will also work using netcat echo "flush_all" | nc -q 2 localhost 11211 Then just wait for the "OK".


10

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 ...


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 ...


9

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


9

As Mike said, you can look at the line including the "STAT bytes" to see memory usage: $ echo "stats" | nc -w 1 <host> <port> | awk '$2 == "bytes" { print $2" "$3 }'


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 ...


7

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 ...


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

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

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 ...


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

It has been a year since this question and I don't know if you found your answer but I'm going to say your perception of "wasted" is wrong. Wasted memory is allocated in memory so it can not be used by another application, but it still is available for memcached. To simplify the explanation, assume you have a memcache with 3MB of ram with 3 Slabs: slab ...


6

You did not tell us about your OS/distro. Also, you did not tell us how you installed memcached. Usually, you will get a sample config file under /etc/ when you install memcached using apt-get under debian-based systems and rpm or yum under redhat, fedora or centos. If you installed it from source, you may not get a sample file under /etc/ (I did not ...


6

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


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. ...



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