memcached

In Django/python, how do I set the memcache to infinite time?

戏子无情 提交于 2019-12-05 02:27:58
cache.set(key, value, 9999999) But this is not infinite time... def _get_memcache_timeout(self, timeout): """ Memcached deals with long (> 30 days) timeouts in a special way. Call this function to obtain a safe value for your timeout. """ timeout = timeout or self.default_timeout if timeout > 2592000: # 60*60*24*30, 30 days # See http://code.google.com/p/memcached/wiki/FAQ # "You can set expire times up to 30 days in the future. After that # memcached interprets it as a date, and will expire the item after # said date. This is a simple (but obscure) mechanic." # # This means that we have to

DevOps: 一例高负载多并发服务器连接池满的异常排解过程

馋奶兔 提交于 2019-12-05 02:21:42
今天是三八国际妇女节, 也是中国农历二月二/龙抬头的节日,恭祝女同胞节日快乐!恭祝中国善良的人们都抬头见喜! 好一阵子没更新Blog,今天也借这喜气冲刷一下往日的阴霾,经过多日的观察,终于找到这阵子“有福新闻”高负载多并发服务器的异常报错背后的原因之一。此前在Blog中频繁观测到 GWA2 PHP Memcached的报错,并且在代码层面进行了多次调优,问题暂时得到缓解,深层并未深究出个所以然。 “GWA2 PHP Memcached自动追加服务器连接?一例缓存服务被击穿的异常分析”, -R/52SP 。 在进行日常服务器状态巡检时,先是发现 Apache 在数日的持续运行中,会有 segmentation fault 导致的死掉,于是对 Apache 2.4.x 进行升级到最新版的操作,然而加了保护措施。尽管偶尔有 Apache child 有 segmentation fault退出,但整个服务顽强的活着. 后续几日的连续观测中,Apache暂无异常死掉,而 GWA2 PHP Memcached再次开始报错,报错信息为唯一的 127.0.0.1/11211 服务被标记为 DEAD (error code: 35). 然而在终端用 telnet 进行手工模拟时,memcached的服务又是正常的,这是为何?时好时坏,随机出错吗? 近日继续探测,在最近的一次服务器上尝试使用

PHP面试题汇总

别说谁变了你拦得住时间么 提交于 2019-12-05 02:02:31
1、酒店预订怎么实现?怎么设计表 你好,我大概的说下我们的业务流程,我们的业务流程是:用户在网站浏览酒店信息,可以根据地区检索出该地区的酒店信息。列表展示酒店的信息由:酒店的名称,酒店图片,酒店位置,评论人数,评论分数以及最低入住价格。用户选中要入住的酒店进入酒店详情页面,查看酒店的介绍以及酒店的房型列表,用户根据他要入住的时间和离店的时间,检索出这个时间段内的所有可选房型(房间数量-当天的订单-当天未离店订单=剩余房间数量)显示给用户。用户选择好房型后就可以进行下单,要求有订单的开始时间,结束时间,房间数量,住客姓名,抵店时间,联系方式,备注信息等等。 那我的表是这么设计的,总共有6张表,分别是: 用户表user,里面有下面几个字段,(用户编号,用户名称,用户密码,用户联系方式) 酒店表hotel,里面有(酒店编号,酒店名称,酒店图片,评论人数,评论分数,最低入住价格,所在地区) 酒店图片表pic(图片编号,图片地址,图片排序,图片所属酒店) 评论表comment(评论编号,评论内容,评论时间,用户编号,酒店编号) 房型表house(房型编号,床型,早餐,宽带,人数上限,房价,房间数量,最长预定时间) 订单表order(订单编号,开始时间,结束时间,房间数量,住客姓名,最晚抵店时间,联系电话,使用优惠券,备注,订单状态) 以上就是我对这个酒店预订系统的设计 2

How does Redis achieve the high throughput and performance?

吃可爱长大的小学妹 提交于 2019-12-05 01:49:56
问题 I know this is a very generic question. But, I wanted to understand what are the major architectural decision that allow Redis (or caches like MemCached, Cassandra) to work at amazing performance limits. How are connections maintained? Are connections TCP or HTTP? I know that it is completely written in C. How is the memory managed? What are the synchronization techniques used to achieve high throughput inspite of competing read/writes? Basically, what is the difference between a plain

Failed to write session data, php and memcached

百般思念 提交于 2019-12-05 01:03:18
I have recently tried implementing memcached for session saving in php. I modified the session.save_handler in my php.ini and for the most part it works correctly. Sessions are saved in it. However, once in a while, I get this weird message for certain sessions: PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (x.x.x.x:11211) in Unknown on line 0. The session data is the same, way under the 1MB barrier of memcached and I have yet to see a pattern in the occurences of this message... maybe a couple of times

Page Caching with Memcached

南笙酒味 提交于 2019-12-05 00:51:38
问题 I am using Memcached in my Ruby on Rails 3 app. It works great with action and fragment caching, but when I try to use page caching, the page is stored in the filesystem instead of in Memcached. How can I tell Rails to use Memcached for page caching too? In my development.rb file: config.action_controller.perform_caching = true config.cache_store = :mem_cache_store 回答1: You cant. The equivalent of page caching in memcached is action caching, because the request must be served through Rails.

Where's php_memcached.dll available now? [closed]

你说的曾经没有我的故事 提交于 2019-12-05 00:22:15
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 5 years ago . I can only find php_memcache.dll ,can't find php_memcached.dll after searching for several hours... You can try this: memcached-client from https://github.com/fwolf/memcached-client : "As there has no php memcached extension for windows now, it's difficult to build develop envionment, so this class will be helpful. Inspried by: http://github.com/joonas-fi/xslib-memcached " Usage: Just as php_memcached extension,

Does memcached share across servers in google app engine?

跟風遠走 提交于 2019-12-04 22:13:17
问题 On the memcached website it says that memcached is a distributed memory cache. It implies that it can run across multiple servers and maintain some sort of consistency. When I make a request in google app engine, there is a high probability that request in the same entity group will be serviced by the same server. My question is, say there were two servers servicing my request, is the view of memcached from these two servers the same? That is, do things I put in memcached in one server

彻底理解cookie,session,token

别等时光非礼了梦想. 提交于 2019-12-04 21:56:22
发展史 很久很久以前,Web 基本上就是文档的浏览而已, 既然是浏览,作为服务器, 不需要记录谁在某一段时间里都浏览了什么文档,每次请求都是一个新的HTTP协议, 就是请求加响应, 尤其是我不用记住是谁刚刚发了HTTP请求, 每个请求对我来说都是全新的。这段时间很嗨皮 但是随着交互式Web应用的兴起,像在线购物网站,需要登录的网站等等,马上就面临一个问题,那就是要管理会话,必须记住哪些人登录系统, 哪些人往自己的购物车中放商品, 也就是说我必须把每个人区分开,这就是一个不小的挑战,因为HTTP请求是无状态的,所以想出的办法就是给大家发一个会话标识(session id), 说白了就是一个随机的字串,每个人收到的都不一样, 每次大家向我发起HTTP请求的时候,把这个字符串给一并捎过来, 这样我就能区分开谁是谁了 这样大家很嗨皮了,可是服务器就不嗨皮了,每个人只需要保存自己的session id,而服务器要保存所有人的session id ! 如果访问服务器多了, 就得由成千上万,甚至几十万个。 这对服务器说是一个巨大的开销 , 严重的限制了服务器扩展能力, 比如说我用两个机器组成了一个集群, 小F通过机器A登录了系统, 那session id会保存在机器A上, 假设小F的下一次请求被转发到机器B怎么办? 机器B可没有小F的 session id啊。 有时候会采用一点小伎俩:

Error installing memcached gem on Snow Leopard - wrong architecture?

血红的双手。 提交于 2019-12-04 21:08:53
I'm having an issue installing the memcached ruby gem on my Mac Pro machine with OS X Snow Leopard (10.6.4). Memcache is installed and working fine and for most projects I use the memcache-client gem without issue, but this current project I need to use the memcached gem instead. Installing the gem with env ARCHFLAGS='-arch x86_64' gem install memcached or just via the normal gem install memcached both give the same error when trying to run the application: (in /src/mojotech/projectr) dlopen(/Users/cpjolicoeur/.rvm/gems/ruby-1.8.7-p174/gems/memcached-0.19.7/lib/rlibmemcached.bundle, 9): no