ncache

2,456 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,456
On SlideShare
0
From Embeds
0
Number of Embeds
82
Actions
Shares
0
Downloads
25
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ncache

  1. 1. NCACHE <ul><li>The fast web cache server base on nginx </li></ul><ul><li>Use aio sendfile and epoll modules </li></ul><ul><li>The self sort share mem hash index </li></ul><ul><li>High performance and large storage </li></ul><ul><li>Low cpu cost and low iowait </li></ul><ul><li>Record lock instead of process lock </li></ul><ul><li>Without http headers cache </li></ul>
  2. 2. OVERVIEW F5 NGINX PROXY NCACHE BACKEND BACKEND BACKEND
  3. 3. STRUCTURE Be proxy hash index Init by Ngx master process when nginx is start on Ngx worker process Ngx worker process Disk Files Read / write by file system or raw dev Backend server Backend server Backend server Body filter Get the proxy content and save into the disk by aio
  4. 4. Logic Diagram Request Request Find cache in index found Not found Timeout? not yes Sendfile output Proxy backend Body filter Writev output Aiowrite fresh index
  5. 5. The self sort share mem hash index 2(5) 3(4) First floor of hash index List to solve the conflict of the hash Hash_malloc 1(6) Index[1]+2 = 7 1(6) 3(4) 2(7) Top:0 16777216 33554432 If arrived at the bottom of the share memory then ncache will return to the 16777216 point and find which can be reused
  6. 6. Record lock Mmap auto sync Mem index Sync file Worker process Worker process Read Write Worker process Do not need to lock any worker process or request cause wait not cause wait not cause wait
  7. 7. Performance between SQUID 1 First: cpu last: io Blue is ncache
  8. 8. Performance between SQUID 2 SQUID NCACHE
  9. 9. Future <ul><li>The aio_sendfile function </li></ul><ul><li>Compress share memory hash index </li></ul><ul><li>Memory cache the hottest data </li></ul><ul><li>Raw device read and write </li></ul><ul><li>Distribute storage system </li></ul><ul><li>Aio queue with lio_listio function </li></ul>
  10. 10. The end <ul><li>Google code: </li></ul><ul><ul><li>http:// code.google.com/p/ncache / </li></ul></ul><ul><li>Nginx wiki: </li></ul><ul><ul><li>http://wiki.codemongers.com/ </li></ul></ul><ul><li>Our mail: </li></ul><ul><ul><li>[email_address] </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul>

×