memcached

Memcached slow queries

徘徊边缘 提交于 2019-12-11 10:34:54
问题 I am actually expecting slow response times for certain requests on memcached. I am running a nodeJS server, the client is node-memcached. From the log files, I extracted the response times distribution which looks like this: Count Response time (ms) 6204 00001 4627 00002 1465 00003 414 00004 141 00005 69 00006 23 00007 17 00008 11 00009 2 00010 2 00011 2 00012 1 00015 1 00016 1 00020 1 00023 1 00024 1 00026 1 00076 1 00212 1 00213 1 00214 1 00215 1 00217 1 00219 1 00220 1 03004 1 03010 What

Redis 是单线程的,为什么这么快?

假如想象 提交于 2019-12-11 08:50:11
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 近乎所有与Java相关的面试都会问到缓存的问题,基础一点的会问到什么是“二八定律”、什么是“热数据和冷数据”,复杂一点的会问到缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题,这些看似不常见的概念,都与我们的缓存服务器相关,一般常用的缓存服务器有Redis、Memcached等,而笔者目前最常用的也只有Redis这一种。 如果你在以前面试的时候还没有遇到过面试官问你《为什么说Redis是单线程的以及Redis为什么这么快!》,那么你看到这篇文章的时候,你应该觉得是一件很幸运的事情!如果你刚好是一位高逼格的面试官,你也可以拿这道题去面试对面“望穿秋水”般的小伙伴,测试一下他的掌握程度。 好啦!步入正题!我们先探讨一下Redis是什么,Redis为什么这么快、然后在探讨一下为什么Redis是单线程的? 一. Redis 简介 Redis是一个开源的内存中的数据结构存储系统,它可以用作:数据库、缓存和消息中间件。 它支持多种类型的数据结构,如字符串(String),散列(Hash),列表(List),集合(Set),有序集合(Sorted Set或者是ZSet)与范围查询,Bitmaps,Hyperloglogs 和地理空间(Geospatial)索引半径查询。其中常见的数据结构类型有:String、List

MemCached client with Delphi

拈花ヽ惹草 提交于 2019-12-11 07:58:23
问题 Hallo, Does anyone perhaps know how to interface with a MemCached server (linux) from within a Delphi win32 application? I am unable to find a general C DLL client, or perhaps delphi code to communicate to the server. Any suggestions/help would be appreciated. Thanks Eric Grobler 回答1: A Delphi client for Memcached can be found on google code: http://code.google.com/p/delphimemcache/ 回答2: Since the protocol is fairly simple, just about any library which handles telnet should be able to handle

【12.10】memrcached(下)

心已入冬 提交于 2019-12-11 07:53:50
【12.10】memrcached(下) 21.5 memcached命令行 21.6 memcached数据导出和导入 21.7 php连接memcached 21.8 memcached中存储sessions 21.5 memcached命令行 [ root@arslinux-01 ~ ] # telnet 127.0.0.1 11211 Trying 127.0.0.1 .. . Connected to 127.0.0.1. Escape character is '^]' . set key2 0 30 2 12 STORED set key1 0 20 3 abc STORED get key1 VALUE key1 0 3 abc END get key2 END set key名 过期时间 value的值 Memcached 语法规则: <command name> <key> <flags> <exptime> <bytes>\r\n <data block>\r\n 注: \r\n在windows下是Enter键 <command name> 可以是set, add, replace set 表示按照相应的 存储该数据,没有的时候增加,有的时候覆盖 add 表示按照相应的 添加该数据,但是如果该 已经存在则会操作失败 replace 表示按照相应的 替换数据

How do I prevent AppEngine memcache flushes

感情迁移 提交于 2019-12-11 07:39:32
问题 We are currently using AppEngine's memcache to store session information (session tokens) and to cache some HTML data. Our overall memcache usage is below 1 MB most of the time. How do we prevent the cache to flush after a few minutes (this morning we had a after 40 minutes with only 25 KB). Yesterday (2013-10-15 21:30 UTC - 2013-10-15 21:45) we had flushes sometime within 2 to 7 seconds (with below 20 KB of data)? 回答1: With the default free memcache your apps memcache data is stored along

Memcache expiration times

余生长醉 提交于 2019-12-11 07:29:37
问题 Is it possible to obtain the remaining time left for a value stored in memcache? 回答1: No. Memcache expire times are only a courtesy and not a guarantee . Any item in the cache may be purged at any time. 回答2: No it is not. If you want something like that, you need to encode it into your value. 回答3: Yes you can, but it is not a guaranteed value, since it can be purged. I would only advice to check this on a development environment, though. function getMemcacheKeys() { $memcache = new Memcache;

How to use JCache in Scala? I get compiler type error: found String required K

丶灬走出姿态 提交于 2019-12-11 06:39:18
问题 I'm learning Scala and trying to use javax.cache in Scala code and can't find how to solve this problem: val cacheFactory = CacheManager.getInstance.getCacheFactory val map = new HashMap val cache = cacheFactory.createCache(map) def rawSet(key:String, value:Array[Byte]) { cache.put(key, value) } and the compiler error is: error: type mismatch found: String required: K in cache.put(key, value) Edit: As Daniel said, I should have mentioned in the question that I'm over app engine since that

Remove keys from cache

时间秒杀一切 提交于 2019-12-11 06:36:53
问题 I'm using memcached and c++. I want to remove all keys from server using c++ api. It would be better to remove them without list of the keys. There is function in documentation: memcached_dump and memcached_delete. First one returns the list of keys, and the second one - removes them. But here is the quote from the docs of first function: memcached_dump() is used to get a list of keys found in memcached(1) servers. Because memcached(1) does not guarentee to dump all keys you can not assume

memcached get function always returns 'bool(false)'

萝らか妹 提交于 2019-12-11 06:21:19
问题 Memcached should be installed correctly. I'm using php 5.4 memcached settings With this code I should get '99' as a result but I end up with 'bool(false)'. $m = new Memcached(); $m->addServer('localhost', 11211); $m->set('int', 99); var_dump($m->get('int')); 回答1: This has been asked long ago, yet ranks up at Google search so the answer might be helpful for someone looking for the answer to this question. Check if Memcached is really installed Run the command telnet 127.0.0.1 11211 and if the

Memcache to deal with high latency web services APIs - good idea?

99封情书 提交于 2019-12-11 06:12:39
问题 I have a PHP application that calls web services APIs to get some objects before rendering a web page that incorporates those objects. In some cases these APIs are really slow (seconds) and that is not acceptable from a user experience point of view. Two things I know I can do... Use ajax and make these calls in the background Time out the call and degrade gracefully if it is taking too long Neither is ideal, so I was thinking about using memcache (the PHP extension for memcached) to cache