How memcache works?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
104 views
Hello...

In the development phase of the project was faced with the question:

Is it normal in 1 key push about 6 MB of text (object YouTube class) ie cache 6 MB of text in 1 key? Of such keys to 6 MB can be tens of thousands.

And another question: Menkes stores data on the HDD or in RAM?

If operational, the maximum I can record 64 meters (if the limit is 64)?


Yesterday lokalhosta checked the article in memcache...
Number of bytes this server is allowed to use for storage has 64 Mega Bytes

And
Total number of bytes read by this server from network already 69.00498104098 Mega Bytes

in this case
Number of valid items removed from cache to free memory for new items is equal to zero...


But why then no rewriting has happened?
by | 104 views

6 Answers

0 like 0 dislike
code.google.com/p/memcached/wiki/FAQ#Why_are_items_limited_to_1_megabyte_in_size?
\r
1 entry in memcache can not be more than 1 megabyte. To store 6 MB of data for each key you have a certain way to prekapillarov Menkes, with possible performance degradation and other side effects.
\r
Generally memcached is a mechanism developed for caching web pages, which rarely need to store data more than 1 megabyte in length. Perhaps you should look for another solution for caching data, or come up with another way to store the YouTube-objects in text form.
by
0 like 0 dislike
memcached is a simple thing: it is a dictionary (like in a php array or dict in python) a limited amount of hanging in the memory of a single process with a simple access Protocol that can be used by other processes.
\r
If a record total of more than exhibited a limit on the size, the old data (which is the longest not used) will be overwritten.
\r
Think of it roughly like $a['vasia'] = 'petya', but like data in the $a variable is preserved between calls, available not only for the specific script + security of these data is not guaranteed.
\r
Regarding limitations on the size of the values should read here.
\r
You at this stage want to record tens of thousands of large objects (by the way, I do not understand any of the objects — that is 6M text, something about youtube) in memory to provide fast access to them. Don't know if this is the problem you want to solve. Then you need to recompile memcached and a large amount of RAM.
by
0 like 0 dislike
memcache stores data completely in memory, and if I remember correctly, he do not care on the size of the data under lock and key. And about the number of read data from the network — so dunno what he was reading... Need to see exactly how much data it turns.
by
0 like 0 dislike
suppose that the Total number of bytes read by this server from network takes into account the total length of the packet. i.e. "SET keyname_312 vaaaalllluuuueeeeee", and maybe even this figure included the total size of all packets received with GET commands.
hence the discrepancy.
by
0 like 0 dislike
about Memcache I recommend reading www.opennet.ru/base/dev/memcached_tips.txt.html
a lot should become clearer. In General, if doubt "break — won't break if the site will come 100,000 users" try to use a prototyping and testing.
\r
To see what is happening in memcached through telnet interface
\rlzone.de/articles/memcached.htm
by
0 like 0 dislike
If I understand correctly your task, the tool you have chosen is clearly wrong. Mimkes not designed for such volumes of data 6мбх10000видео — 60гиг operatives:) I would do a video stored in a nosql database, and топ500-1000 for example zakeshirovalo in Menkes.
\r
>>Yesterday at localhost checked the article in memcache...
>>Number of bytes this server is allowed to use for storage has 64 Mega Bytes
>>
>>Total number of bytes read by this server from network already 69.00498104098 Mega Bytes
>>at the same time
>>Number of valid items removed from cache to free memory for new items is equal to zero...
\r
The last parameter is the number of objects whose lifetime has not expired, but they had to displace due to filling of available RAM limit. And objects which died "of old age" here are not considered — so not surprising that the information given is more than is in the memory — just some of the old time will be replaced.
\r
Well, about myself Menkes — you can put it volume and life time of objects
by

Related questions

0 like 0 dislike
1 answer
asked May 20, 2019 by McMike
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
27,900 users