Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
http { # proxy_cache_pathã¨proxy_temp_pathã¯åããã¡ã¤ã«ã·ã¹ãã ä¸ã«é ç½®ããã®ãããã©ã¼ãã³ã¹ä¸ãã # keys_zoneã®1mã¯å ±æã¡ã¢ãªã®ãµã¤ãºã1MiBãããç´8000åã®ãã¼ãä¿æã§ããã®ã§ãããã»ã©å¤§ãããªãã¦è¯ã # max_sizeã¯å ¨ãã£ãã·ã¥ãã¡ã¤ã«ã®ãµã¤ãºåè¨ã®ä¸é # inactiveã§æå®ããæéå ã«ã¢ã¯ã»ã¹ãããªãã£ããã£ãã·ã¥ãã¡ã¤ã«ã¯ããã®æå¹æéã«é¢ãããåé¤ãããï¼ããã©ã«ãã§10åï¼ proxy_cache_path /var/cache/nginx keys_zone=zone1:1m max_size=1g inactive=24h; proxy_temp_path /var/cache/nginx_tmp; # ãªãªã¸ã³ããæ¥ãCache-Controlãç¡è¦ãã #proxy_ignore_headers
ãã®è¨äºã¯ Perl5 Advent Calendar 2015 ã®7æ¥ç®ã®è¨äºã§ããæ¨æ¥ã¯ã @karupanerura ããã® XSãã¨ã¯ãã ã§ããã ä»åã¯ãRedisãPerlã§æ±ãä¸ã§ã®ä¾¿å©CPANã¢ã¸ã¥ã¼ã«ãç´¹ä»ãã¾ããå¤§ä½ @shogo82148 ç¡åã«ãªãã¾ãã Redis::Fast Redisã¯ã©ã¤ã¢ã³ãã¯Redis::Fastä¸æã§ããRedis.pmãå ¬å¼æ¨å¥¨ã®ã¢ã¸ã¥ã¼ã«ã§ãããããã¯Pure Perlå®è£ ãªã®ã§ããã©ã¼ãã³ã¹ãããã»ã©è¯ãããã¾ããã Redis::Fastã¯Redis.pmäºæã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãæã£ãXSã¢ã¸ã¥ã¼ã«ã§ãããå é¨çã«ã¯Rediså ¬å¼ã®Cã¯ã©ã¤ã¢ã³ãã§ããhiredisã®ãã¤ã³ãã£ã³ã°ã«ãªã£ã¦ããã®ã§ãå®å®ãã¦ãã¦ä½¿ããããã¨ãããã§ãããã my $redis = Redis::Fast->new; $redis->incr('
å¤ãæç« ã ãã©ãCaching Tutorial for Web Authors and Webmasters ãèªãã ã¡ã¢ãã¦ã§ããã¹ã¿ã¼åãã®ãã©ã¦ã¶ãã£ãã·ã¥ã®æ¦è¦ã ãã©ã¦ã¶ãã£ãã·ã¥ã¯ããã©ã¦ã¶ããµã¼ãããã¬ã¹ãã³ã¹ããããªã½ã¼ã¹ã (å ´åã«ãã£ã¦ã¯) ãã¼ã«ã«ã«ä¿åãã¦ããã¦ãäºåº¦ç®ä»¥éã®è¡¨ç¤ºã§ã¯ (å ´åã«ãã£ã¦ã¯) ãã£ãã·ã¥ããèªãã¨ããåä½ãç¡é§ãªãªã¯ã¨ã¹ããæ¸ããã¨ã§ãµã¼ããªã½ã¼ã¹ã«ãåªããããã¦ã¼ã¶ã¼ã«ã¨ã£ã¦ã¯è¡¨ç¤ºé度åä¸ã¨ããã¡ãªãããããã ã³ã³ãã³ããã©ã®ããã«ãã£ãã·ã¥ããããããµã¼ãã UA ã« HTTP ããããå©ç¨ãã¦æ示ãããExpires ã Cache-Control ãããããã®ä¾ã ãhtml ã® meta è¦ç´ ã§ããã¨ãã° <meta http-equiv="Cache-Control" content="no-store" /> ã¨ãããµãã«
ã¡ã¢ãnginxã®ãªãã¼ã¹ãããã·ã§ãã¡ã¤ã«ããã£ãã·ã¥ããæ¹æ³ã è¨å®ãããã¼ã¸ã¯ãããããã¯ã¨ã³ãã¯GoogleAppEngineã http://www.nullpobug.com/ 試ããnginxã®ãã¼ã¸ã§ã³ã¯0.7ãUbuntu10.04ã®ãªã®ã§å¤ãã nginxã®è¨å® nginx.confã®ä¸ã§conf.dãsites-enabledãincludeãããããã«ãªã£ã¦ããã¨ãåæã /etc/nginx/conf.d/proxy_cache.conf proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=my-key:16m max_size=100m inactive=120m; proxy_temp_path /var/cache/nginx/tmp;httpãã£ã¬ã¯ãã£ãã«proxy_cache_pat
ããã¨é·ãéæ©ãã§ãããã ãã©ãæè¿è§£æ±ºããã®ã§ã¡ã¢ã ãµã¼ãã¹ã§å©ç¨ãã¦ããsmalllightã®ç»åå¤æãµã¼ãããApacheã使ã£ã¦ããã¡ã¢ãªä»¥ä¸ã®ã¡ã¢ãªã使ç¨ããSwapãããã¡ã¢ãªæ¯æ¸ã§ãµã¼ãããã¦ã³ãããªã©ã®ãã¨ãä½åº¦ãããã¾ããã âã¡ã¢ãªã®åãã¯ãããªæã ãããã調ã¹ãçµæãdentry cacheããªããã®ãã¡ã¢ãªå¤ããå ãã¦ãããã¨ããããã¾ãããdentry cacheã¯ãã£ã¬ã¯ããªããã¡ã¤ã«åã¨inodeã¨ãçµã³ã¤ãã«ä½¿ããããã£ãã·ã¥ã§ããsmalllightã§ã¯ç»åãå¤æããéã«ä¸æãã¡ã¤ã«ãä½æããã®ã§ããã®æ å ±ãæ®ãããã§ãã æå ã§åç¾ããã æ¬çªã§ä½¿ã£ã¦ãããµã¼ãã¯CentOS5ç³»ã§ãããæå ã®Vagrantä¸ã®CentOS6(ãã¡ã¤ã«ã·ã¹ãã ã¯ext4)ã§ãåç¾ããã¦ã¿ã¾ããã use Parallel::Prefork; use File::Tem
SSLã§ä¿è·ããã¦ãããã¼ã¸ã®å ´åãFirefoxãSafariãªã©ã§ã¯éçã³ã³ãã³ãããã£ãã·ã¥ãããªãããã ã æ¯åãç»åã¨ãããªã¯ã¨ã¹ããããã¨æç»ãé ãã®ã§ãä¸è¨ã®ããã«ããã°SSLã®å ´åã§ããã£ãã·ã¥ãããããã«ãªãã¿ããã <IfModule expires_module> ExpiresActive On <FilesMatch ".(jpeg|jpg|gif|png|gz|css|js)$"> ExpiresDefault "access plus 10 days" Header onsuccess append Cache-Control public </FilesMatch> </IfModule> éè¦ãªã®ã¯ä¸è¨ã®1è¡ã Header onsuccess append Cache-Control public ããã§ã¡ããã¨ãã£ãã·ã¥ãããããã«ãªãã¾ããããã§ãã
https://github.com/tokuhirom/Cache-Memory-Simple/blob/master/lib/Cache/Memory/Simple.pm Expire ããããã¼ã¿ãã¨ããªããªãã ãã®ãã¤ã¼ããªãã£ãã·ã¥å®è£ ãããã¾ããã ããã¨ã¿ããªæã§ããã¦ãã¨ããããã§ãããæã§ããã¨ãã°ããããããã¹ãããã®ãé¢åãªã®ã§ CPAN ã«ããã¦ããã¨ãããã¤ãã®ã¢ã¬ã§ããExpire ãããã¦ã·ã³ãã«ã§ã¯ããããªã®ããªãã£ããã§ã¾ãã 10ç§ãããhttpdã®ä¸ã«ãªã³ã¡ã¢ãªãã£ãã·ã¥ãã¨ããããªããã¨ããæãªã©ã«ã©ããã 使ãæ¹ã¯ä»¥ä¸ã®ãããªãããã§ãã use Cache::Memory::Simple; use feature qw/state/; sub get_stuff { my ($class, $key) = @_; state $cache = C
以ä¸ã®ã³ã¼ãã¯Digest::MD5ã®ãªãã¸ã§ã¯ãAPIã®ä½¿ç¨æ¹æ³ã use strict; use Digest::MD5; my $md5 = Digest::MD5->new; $md5->add("foo"); $md5->add("bar"); $md5->add("baz"); warn $md5->hexdigest; # 6df23dc03f9b54cc38a0fc1483df6e21 $md5->add("hoge"); warn $md5->hexdigest; # ea703e7aa1efda0064eaa507d9e8ab7e warn $md5->hexdigest; # d41d8cd98f00b204e9800998ecf8427e æåã®hexdigest() ã®å¼ã³åºã㯠"foo", "bar", "baz"ã®å¤ã使ã£ã¦è¨ç®ããMD5ã®å¤ã次ã®å¼ã³åºãã¯
ã¬ã¹ãã³ã¹ã®HTMLãã¾ãã£ã¨ãã£ãã·ã¥ããpluginæ¸ãããæ¸ããã¨ãããå¥ã®WAFã§ä½¿ã£ã¦ããã¤ãAmon2ç¨ã«æ¸ãç´ããããã£ãã·ã¥å ã¯memcachedã§ãã dameninngenn/p5-Amon2-Plugin-Web-PageCache · GitHub ããããã£ãã㨠requestã®pathæ¯ã«ãã£ãã·ã¥ãããå¦ãè¨å®ã§ããããã«ããã requestã®pathæ¯ã«ãã£ãã·ã¥ã®expireè¨å®ã§ããããã«ããã /path/to?p=1 㨠/path/to?p=2 ã¯å¥ã®ãã®ã¨ãã¦ãã£ãã·ã¥ããã æ³å®ãã¦ãªãã¯ã¨ãªãã¤ãã¦ããå ´åã¯ã¹ã«ã¼ãã¦ã¯ã¨ãªãã¤ãã¦ãªããã®ã¨åãæ±ãã«ããã requestã®pathæ¯ã«ãã£ãã·ã¥åé¤ãã§ããããã«ããã HTMLã ããããªãã¦JSONè¿ãã¦ãå ´åããã£ãã·ã¥ããã ãããããæ軽ã«ä½¿ããããã«ããã 使ãæ¹ ã¢ã¸ã¥ã¼ã«ã
Cache::LRU::WithExpires - can set an expiration for the Cache::LRU - metacpan.org Cache::LRU ã« expires ã®æ©è½ãã¤ããã ãã®ã¢ã¸ã¥ã¼ã«ã§ããã æåã¯ãããã¯ãã®ã³ã¼ãã§ä½¿ã£ã¦ãã¾ããããã ãã (ãããã°ãã£ã©ããï¼) ãã³ãããã¦åå©ç¨ãã¦ããã¨ãã話ãèãã¦ãã¾ãéè¦ãããªãåºããã¼ã£ã¦æãã§èãã¦ã¦ãã£ããå¿ãã¦ããã§ããæãåºããã®ã§åºãã¾ããã£ã¦ããã¹ãã¼ãªã¼ã§ãã 使ãæ¹ã¯ç°¡åã§ããªã±ãã« expires ãæå®ããã ãã§ããTime::HiRes ãã¦ããã®ã§ãããªç§ã OKã use Cache::LRU::WithExpires; my $cache = Cache::LRU::WithExpires->new; $cache->set('hirose', '31',
ã¯ã¦ãªã°ã«ã¼ãã®çµäºæ¥ã2020å¹´1æ31æ¥(é)ã«æ±ºå®ãã¾ãã 以ä¸ã®ã¨ã³ããªã®éããä»å¹´æ«ãç®å¦ã«ã¯ã¦ãªã°ã«ã¼ããçµäºäºå®ã§ããæ¨ããç¥ãããã¦ããã¾ããã 2019å¹´æ«ãç®å¦ã«ãã¯ã¦ãªã°ã«ã¼ãã®æä¾ãçµäºããäºå®ã§ã - ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ ãã®ãã³ãæ£å¼ã«çµäºæ¥ã決å®ãããã¾ããã®ã§ã以ä¸ã®éãã確èªãã ããã çµäºæ¥: 2020å¹´1æ31æ¥(é) ã¨ã¯ã¹ãã¼ãå¸æç³è«æé:2020å¹´1æ31æ¥(é) çµäºæ¥ä»¥éã¯ãã¯ã¦ãªã°ã«ã¼ãã®é²è¦§ããã³æ稿ã¯è¡ãã¾ãããæ¥è¨ã®ã¨ã¯ã¹ãã¼ããå¿ è¦ãªæ¹ã¯ä»¥ä¸ã®è¨äºã«ãããã£ã¦æç¶ãããã¦ãã ããã ã¯ã¦ãªã°ã«ã¼ãã«æ稿ãããæ¥è¨ãã¼ã¿ã®ã¨ã¯ã¹ãã¼ãã«ã¤ã㦠- ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ ãå©ç¨ã®ã¿ãªãã¾ã«ã¯ãè¿·æãããããããã¾ãããã©ãããããããé¡ããããã¾ãã 2020-06-25 è¿½è¨ ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ã®ã¨ã¯ã¹ãã¼ããã¼ã¿ã¯2020å¹´2æ28
å æ¥ããªã³ã¡ã¢ãªãªãã£ãã·ã¥ã¢ã¸ã¥ã¼ã« Cache::LRU ãæ¸ãã¾ãããKazuho's Weblog: Cache::LRU (a handy and fast in-memory cache module in pure-perl) ãè¦ã¦ããã ããã°ãCache::LRU ãä»ã®ã¢ã¸ã¥ã¼ã«ããéããã¨ã¯æããã ã¨æãã¾ããé度差ã®åå ã¨ãã¦ã¯æ©è½ãå®è£ ä¸ã®å·®ç°ãããã®ã§ãããè¨è¨ä¸ã®å·¥å¤«ã Cache::LRU ãéãçç±ã®ã²ã¨ã¤ã§ãã LRU (Least Recently Used) ã¢ã«ã´ãªãºã ãåãããã£ãã·ã¥ãå®è£ ãããã¨æãã¨ã ã¨ã³ããªã«ãã¯ã¢ããã®ããã®ããã·ã¥ ã¢ã¯ã»ã¹é ã表ç¾ããããã®ãªã¹ã ã®ï¼ç¨®é¡ãçµã¿åãããå¿ è¦ãããã¾ãããªã¹ãã表ç¾ããææ³ã¨ãã¦ã¯é åãå©ç¨ãããã®ã¨ãªã³ã¯ãªã¹ããå©ç¨ãããã®ãããã¾ãããPerl ã ã¨åè ã®ã»ããéããã¨ãããã¨ã¯
Cache::LRU (a handy and fast in-memory cache module in pure-perl) Last week, after not being able to find a handy and fast cache module, I decided to write one by myself, and the outcome is Cache::LRU. Cache::LRU is an in-memory cache module written in pure-perl. It has no dependencies, and the code is less than 100 lines long. Yet it is faster than other modules as the result of a primitive bench
squid : Optimising Web Delivery èªå® ãµã¼ãã«squidãå ¥ãã¦ãiPhoneã¨iPadãsquidçµç±ããããã«ãããããã©ã¦ã¸ã³ã°ãçéã«ãªã£ãã®ã§ã¡ã¢ã ä¸åº¦è¡¨ç¤ºãããã¼ã¸ã¯å½ç¶ã§ãããYoutubeãªã©ã¹ããªã¼ãã³ã°ã¯ååã¢ã¯ã»ã¹æã§ããã¡ããã¡ãæ©ããªãã¾ãã squidãå°å ¥ãããµã¼ãã®OSã¯Fedora15ã§ãç§ã®è¨ç½®ç°å¢ã¯ä¸è¨ã®ããã«ãªãã¾ãã ã«ã¼ã¿ 192.168.11.1 ãµã¼ã 192.168.11.30 (proxy.glidenote.local) iPhone4 192.168.11.2 squidå°å ¥åã®æ§æ squidãç¨æããåã¯ãåç´ã«ç¡ç·ã«ã¼ã¿ãçµç±ãã¦ãå¤ã«ããç¶æ ã +--------+ Wifi +-------------+ +-------+ +----------+ | iPhone | ------> |
Cache::Memcached(::Fast)ã使ãä¸ã§ãã¹ããã©ã¯ãã£ã¹ãã¾ã¨ããã¢ã¸ã¥ã¼ã«ãæ¸ãã¦ã¿ããååã¯ãCache::Memcached::IronPlateããã®ã¿ã¡ç¼ãã githubã«ããã¾ããããã¥ã¡ã³ããæ¥æ¬èªã ãã§ã: https://github.com/kazeburo/Cache-Memcached-IronPlate ã¤ãããã use Cache::Memcached::IronPlate; use Cache::Memcached::Fast; my $memd = Cache::Memcached::IronPlate->new( cache => Cache::Memcached::Fast->new(...). ); $memd->get $memd->get_multi $memd->set $memd->add $memd->replace
ä»äºã§ç»åãã£ãã·ã¥ãµã¼ãã¼ãæ§ç¯ããæã®ã¡ã¢ã大è¦æ¨¡äºä¾ã®è¨å®ä¾ãæ¤ç´¢ãã¦ããã¾ãè¦ã¤ãããªãã£ãã®ã§åããããªå¢éã®èª°ãã®åèã«ãªãã°ã ãã¼ã¯æã®ãã©ãã£ãã¯ã¯æ°Gbps ç»åç·å®¹éã¯æ°åTB ããã¯ã¨ã³ãã®storageãè¤æ°ç¨®é¡ è¦æ¨¡ã¨ã¢ã¯ã»ã¹éã¨ã¢ã¯ã»ã¹ãããç»åã®ç¨®é¡ãå¤ãã®ã§ãsquidã§disk cacheã使ç¨ããã¨COSSçã使ç¨ãã¦ãdiskIOã§è©°ã¾ãçºãå ¨ã¦on memory cacheãcache容éã確ä¿ããçºã«å¿ ç¶çã«cacheãµã¼ãã¼ã®å°æ°ãæ°åå°ã 1. squidãsiblingæ§æã§ä¸¦åã«ä¸¦ã¹ã cache_peer 10.0.1.1 sibling 80 3130 no-query no-digest proxy-only cache_peer 10.0.1.2 sibling 80 3130 no-query no-digest proxy-o
Memcachedã¿ããã«ãã£ãã·ã¥ãã¦ãããWebãµã¼ãã¹ãããã°ä¾¿å©ããã ã¨æã£ãã®ã§ï¼ä½ã£ã¦ã¿ãï¼ ããããã«HTTPã¢ã¯ã»ã¹ããã¨ï¼JSONããããï¼ set, get, delete, statsã®APIãããï¼ä½¿ãæ¹ã¯ä¸ã®ãªã³ã¯å ã«æ¸ããï¼ãªã³ã¯å ã®ã³ã¼ããã¯ãªãã¯ããã¨ãã®å ´ã§XHRãã¦è©¦ããï¼ ãã£ãã·ã¥ãªã®ã§ï¼Webãã¼ã¸ãã使ã£ã¦ä¾¿å©ã¿ãããªæããããªãã¦ï¼ä½ããã£ãã·ã¥ãå©ç¨ãããããã°ã©ã ãã使ãï¼ Rubyããå¤ãè¤æ°setãã¦åãå¤ãgetããä¾ï¼ãã®ããã«ï¼è¤æ°åæã«æä½ã§ããï¼ require 'net/http' require 'open-uri' http = Net::HTTP.new('webmemcache.appspot.com') response = http.post('/set', 'pi=3.14&e=2.7&namespace=te
Cacheã®å®è£ ã¨ãã¦ããã¼ã«ã«ã®ãã¡ã¤ã«ã·ã¹ãã ã使ããã®ã使ã£ã¦ã¿ã¦ã®ææãã¾ã¨ãããã å°å ¥ã«ãã享åã§ããæ©æµ å½ç¶ãªãããDBã¸ã®è² è·ãæ¸ããã ãã¡ã¤ã«ãªã®ã§è¤æ°ããã»ã¹ã§å ±æå¯è½ ãã¼ã«ã«ã«ããã®ã§ãããã¯ã¼ã¯ãã©ãã£ãã¯çºçããªã 注æãã¹ãç¹ ãã¡ã¤ã«I/Oãæèããå¿ è¦ããã key-valueçãªçºæ³ã§ä½¿ãã¨SQLããé ããªããã¨ãããããã ãã¨ãã°æ°çæ¥è¨ã100件ãã£ãã·ã¥ãã¦ãããã¨æã£ãã¨ãã«ã æ¥è¨IDãkeyã«ãã¦ãã¾ãã®ã¯NGã§ããããã®ã±ã¼ã¹ã ã¨100åã®File I/Oãçºçããããã§ããã æãå¹ççã«ããã«ã¯æ°çæ¥è¨100件ãããã·ã¥ãªãã¡ã¬ã³ã¹ã«å ¥ãã¦ã丸ã£ã¨ãã£ãã·ã¥ããã®ãããã ããã§ããã°ãèªã¿åºãã1åã§æ¸ãã ãã³ããã¼ã¯(set) use Cache::FileCache; use Benchmark; my $fcache1
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}