memcached

memcached 和 redis 的区别与选择

雨燕双飞 提交于 2020-01-09 18:10:19
没有必要过多的关注性能。 由于Redis只使用单核,而Memcached可以使用多核 ,所以在比较上,平均每一个核上Redis在存储小数据时比Memcached性能更高。而在100k以上的数据中,Memcached性能要高于Redis,虽然Redis最近也在存储大数据的性能上进行优化,但是比起Memcached,还是稍有逊色。说了这么多,结论是,无论你使用哪一个,每秒处理请求的次数都不会成为瓶颈。 你需要关注内存使用率。对于key-value这样简单的数据储存,memcache的内存使用率更高。如果采用hash结构,redis的内存使用率会更高。当然,这些都依赖于具体的应用场景。 你需要关注 关注数据持久化和主从复制时 ,只有 redis 拥有这两个特性。如果你的目标是构建一个缓存在升级或者重启后之前的数据不会丢失的话,那也只能选择redis。 你应该关心你需要的操作。redis支持很多复杂的操作,甚至只考虑内存的使用情况,在一个单一操作里你常常可以做很多,而不需要将数据读取到客户端中(这样会需要很多的IO操作)。这些复杂的操作基本上和纯GET和POST操作一样快,所以你不只是需要GET/SET而是更多的操作时,redis会起很大的作用。 对于两者的选择还是要看具体的应用场景,如果需要缓存的数据只是key-value这样简单的结构时,我在项目里还是采用memcache

Is it recommended to store PHP Sessions in MemCache?

跟風遠走 提交于 2020-01-09 01:57:09
问题 I'm working with a couple of Web Servers behind a Load Balancer and I can enable Sticky Sessions to hold a user to the one specific Web Servers - this will work. I have been reading about PHP Sessions & MemCache. I must say what I've read is a touch confusing as some pages say its a good idea and others the opposite. Questions: is it possible to keep php sessions in memcache? is it better to use sticky sessions over memcache? what are the problems with php sessions in memcache - note: I can

Is it recommended to store PHP Sessions in MemCache?

孤者浪人 提交于 2020-01-09 01:57:05
问题 I'm working with a couple of Web Servers behind a Load Balancer and I can enable Sticky Sessions to hold a user to the one specific Web Servers - this will work. I have been reading about PHP Sessions & MemCache. I must say what I've read is a touch confusing as some pages say its a good idea and others the opposite. Questions: is it possible to keep php sessions in memcache? is it better to use sticky sessions over memcache? what are the problems with php sessions in memcache - note: I can

openstack dashboard 加载慢的原因

最后都变了- 提交于 2020-01-08 19:13:21
从openstack官网上的部署说明,memcached是yum安装后直接启动的,memcached(当时是memcached-1.4.33-2.el7.x86_64)二进制包的配置是只允许127.0.0.1连接的,这样就出现一个严重的问题,由于所有节点都是访问控制节点的虚拟IP,这样就是所有节点的所有服务都不能访问memcached,即使是控制节点本身也不能访问,只能通过127.0.0.1访问,这样就导致服务请求token的时候都连接到memcached失败然后再重新向keystone请求,在需要请求多种服务的页面就会出现超时的情况,比如管理员下的云主机列表。解决办法就是把memcached监听地址改为所有IP,即 /etc/sysconfig/memcached 文件中的 OPTIONS="-l 0.0.0.0" ,修改后重启memcached,以下是CentOS7+memcached-1.4.33的修改方法: sed -i '/OPTIONS/c OPTIONS="-l 0.0.0.0"' /etc/sysconfig/memcached systemctl restart memcached 修改前和修改后的截图,登录dashbord之后查看一下 memcached 是否有缓存数据 memcached-tool 127.1 dump 来源: 51CTO 作者:

超简单使用MemCached

烂漫一生 提交于 2020-01-08 18:27:55
阅读本文的前提是,你已经安装或者使用了MemCached,或具有相关的基本知识。 今天要介绍的是Simple-Spring-Memcached,它封装了对MemCached的调用,使MemCached的客户端开发变得超乎寻常的简单,只要一行代码就行: @ReadThroughAssignCache(assignedKey = "VETS", expiration = 300, namespace = "NELZ") 是不是很神奇?这行代码指定了MemCached的key,过期时间和命名空间。假设你的MemCached服务器IP是:196.168.10.101,端口是:12000,那么在数据调用的配置文件中只要加上下面配置代码就可以了: 1 <import resource="classpath:simplesm-context.xml" /> 2 3 4 5 <bean id="memcachedConnectionBean" class="net.nelz.simplesm.config.MemcachedConnectionBean"> 6 7 <property name="consistentHashing" value="true" /> 8 9 <property name="nodeList" value="196.168.10.101:12000" />10 11

memcached内存数据库——部署及操作

此生再无相见时 提交于 2020-01-08 01:56:53
概述  Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程(daemon )是用C写的,但是客户端可以用任何语言来编写,并通过memcached协议与守护进程通信。 特点 1、协议简单; 2、基于libevent的事件处理; 3、内置内存存储方式; 4、memcached不互相通信的分布式。 存储方式 为了提高性能,memcached中保存的数据都存储在memcached内置的内存存储空间中。由于数据仅存在于内存中,因此重启memcached、重启操作系统会导致全部数据消失。另外,内容容量达到指定值之后,就基于LRU(Least Recently Used)算法自动删除不使用的缓存。memcached本身是为缓存而设计的服务器,因此并没有过多考虑数据的永久性问题。 实验环境 memcached服务器 192.168.13.128 (memcached-1.5.6.tar.gz、libevent-2.1.8-stable.tar.gz) memcache客户端 192.168.13.129 (memcache-2.2.7.tgz 、LAMP) 1,部署memcached服务器 [root

“sudo make” returns error memcache setup [closed]

若如初见. 提交于 2020-01-06 23:46:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . As per this post. I was able to ./configure after installing libmemcache-devel, but now when I move to the next setup and run sudo make I get the following: Making all in src make[1]: Entering directory `/root/tmp/memcached_functions_mysql-1.1/src' make all-am make[2]: Entering directory `/root/tmp/memcached

memcached缓存服务器的安装

ε祈祈猫儿з 提交于 2020-01-06 01:42:05
一、memcached 的编译安装 准备: Memcached下载地址: http://www.danga.com/memcached/ libevent下载地址: http://monkey.org/~provos/libevent/ 安装步骤: 1. 下载libevent & memcached 源码包 libevent-1.3.tar.gz memcached-1.2.2.tar.gz 2. 解压缩 libevent-1.3.tar.gz ,编译安装 # tar zxvf libevent-1.3.tar.gz # cd libevent-1.3 # ./configure --prefix=/usr/local/libevent # make ; make install 3. 解压缩 memcached-1.2.2.tar.gz, 编译安装 # tar zxvf memcached-1.2.2.tar.gz # cd memcached-1.2.2 # ./configure --prefix=/usr/local/memchached --with-libevent=/usr/local/libevent # make;make install 4. 作软连接,否则运行memcached的时候将找不到libevent模块 # ln -s /usr/local

Linux下缓存服务器的应用

穿精又带淫゛_ 提交于 2020-01-06 01:41:38
摘要: 由于数据库存储的数据量越来越大,查询速度也就变的越来越慢,因此就有了缓存服务器应用的必要,本文是介绍Memcached的安装以及简单的使用。 本文只介绍memcached的PHP的API,想查看其他关于Memcached的API文档案,请访问 http://www.danga.com/memcached/ 目录 一、环境需求 二、下载相关软件 三、安装和配置 1、安装Memcached 2、安装memcache PHP模块 3、测试脚本 四、关于本文 ++++++++++++++++++++++++++++++++++++++++ 正文 ++++++++++++++++++++++++++++++++++++++++ 一、环境需求 安装Memcached需要libevent库的支持,所以请在安装Memcached之前检查有没有安装libevent。测试环境还需要PHP的支持,本文假设PHP已经安装到/usr/local/php目录下,也就是在编译PHP的时候使用perfix参数指定目录(--prefix=/usr/local/php) 二、下载相关软件 Memcached下载地址: http://www.danga.com/memcached/ memcache PHP模块下载地址: http://pecl.php.net/package/memcache 推荐使用1.5版

在Linux上安装Memcached服务

被刻印的时光 ゝ 提交于 2020-01-06 01:41:27
下载并安装Memcache服务器端 服务器端主要是安装memcache服务器端. 下载:http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz 另外,Memcache用到了libevent这个库用于Socket的处理,所以还需要安装libevent,libevent的最新版本是libevent-1.3。(如果你的系统已经安装了libevent,可以不用安装) 官网:http://www.monkey.org/~provos/libevent/ 下载:http://www.monkey.org/~provos/libevent-1.3.tar.gz 用wget指令直接下载这两个东西.下载回源文件后。 1.先安装libevent。这个东西在配置时需要指定一个安装路径,即./configure –prefix=/usr;然后make;然后make install; 2.再安装memcached,只是需要在配置时需要指定libevent的安装路径即./configure –with-libevent=/usr;然后make;然后make install; 这样就完成了Linux下Memcache服务器端的安装。详细的方法如下: 1.分别把memcached和libevent下载回来,放到 /tmp 目录下: # cd /tmp