前言:dbcached 1.0 beta* 在 Memcached 1.2.4 的基础上编写而成,也是我的第一个开源C项目。编写 dbcached 的目的是为了最大限度的发挥 Memcached 内存缓存的优势,便捷地维护 Memcached 服务器节点哈希列表,智能地支持 Memcached 故障转移,同时保证数据的持久化存储。

  dbcached

  协议:New BSD License
  作者:张宴
  网址:http://code.google.com/p/dbcached/

  dbcached 是什么?

  ● dbcached 是一款基于 Memcached 和 NMDB 的分布式 key-value 数据库内存缓存系统。

  ● dbcached = Memcached + 持久化存储管理器 + NMDB 客户端接口

  ● Memcached 是一款高性能的,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度。

  ● NMDB 是一款多协议网络数据库(dbm类)管理器,它由内存缓存和磁盘存储两部分构成,使用 QDBM 或 Berkeley DB 作为后端数据库。

  ● QDBM 是一个管理数据库的例程库,它参照 GDBM 为了下述三点而被开发:更高的处理速度,更小的数据库文件大小,和更简单的API。QDBM 读写速度比 Berkeley DB 要快,详细速度比较见《Report of Benchmark Test》。

  


  Memcached 和 dbcached 在功能上一样吗?

  ● 兼容:Memcached 能做的,dbcached 都能做。除此之外,dbcached 还将“Memcached、持久化存储管理器、NMDB 客户端接口”在一个程序中结合起来,对任何原有 Memcached 客户端来讲,dbcached 仍旧是个 Memcached 内存对象缓存系统,但是,它的数据可以持久存储到本机或其它服务器上的 QDBM 或 Berkeley DB 数据库中。

  ● 性能:前端 dbcached 的并发处理能力跟 Memcached 相同;后端 NMDB 跟 Memcached 一样,采用了libevent 进行网络IO处理,拥有自己的内存缓存机制,性能不相上下。

  ● 写入:当“dbcached 的 Memcached 部分”接收到一个 set(add/replace/...) 请求并储存 key-value 数据到内存中后,“dbcached 持久化存储管理器”能够将 key-value 数据通过“NMDB 客户端接口”保存到 QDBM 或 Berkeley DB 数据库中。

  ● 速度:如果加上“-z”参数,采用 UDP 协议“只发送不接收”模式将 set(add/replace/...) 命令写入的数据传递给 NMDB 服务器端,对 Memcache 客户端写速度的影响几乎可以忽略不计。在千兆网卡、同一交换机下服务器之间的 UDP 传输丢包率微乎其微。在命中的情况下,读取数据的速度跟普通的 Memcached 无差别,速度一样快。

  ● 读取:当“dbcached 的 Memcached 部分”接收到一个 get(incr/decr/...) 请求后,如果“dbcached 的 Memcached 部分”查询自身的内存缓存未命中,则“dbcached 持久化存储管理器”会通过“NMDB 客户端接口”从 QDBM 或 Berkeley DB 数据库中取出数据,返回给用户,然后储存到 Memcached 内存中。如果有用户再次请求这个 key,则会直接从 Memcached 内存中返回 Value 值。

  ● 持久:使用 dbcached,不用担心 Memcached 服务器死机、重启而导致数据丢失。

  ● 变更:使用 dbcached,即使因为故障转移,添加、减少 Memcached 服务器节点而破坏了“key 信息”与对应“Memcached 服务器”的映射关系也不怕。

  ● 分布:dbcached 和 NMDB 既可以安装在同一台服务器上,也可以安装在不同的服务器上,多台 dbcached 服务器可以对应一台 NMDB 服务器。

  ● 特长:dbcached 对于“读”大于“写”的应用尤其适用。


  1. dbcached

  Installation (安装)
引用
wget http://www.monkey.org/~provos/libevent-1.3e.tar.gz
tar zxvf libevent-1.3e.tar.gz
cd libevent-1.3e/
./configure --prefix=/usr
make && make install
cd ../

wget http://dbcached.googlecode.com/files/dbcached-1.0.beta2.tar.gz
tar zxvf dbcached-1.0.beta2.tar.gz
cd dbcached-1.0.beta2/
./configure --prefix=/usr/local/dbcached --with-libevent=/usr
make && make install
cd ../


  Run as a daemon (作为守护进程运行)
引用
/usr/local/dbcached/bin/memcached -d -m 256 -p 11211 -c 51200 -u nobody -x 192.168.0.2 -y 26010 -z 26010


  ● -x nmdb 服务器的域名或者IP地址,推荐使用IP地址

  ● -y <端口号> nmdb 服务器的TCP端口号 (默认: 26010) 支持 set/delete/... 等写命令 和 get 等读命令

  ● -z <端口号> nmdb 服务器的UDP端口号 (默认: 26010) 只支持 get 等都命令, 当使用 -z 参数时,将使用 UDP 协议代替 TCP 协议执行 set 操作,执行 get 操作时仍然使用 TCP 协议。强烈推荐加上 -z 参数。
  ● 其他参数跟 memcached 1.2.4 完全一样,就不再详细说明。

  ● 如果想让 dbcached 通过 NMDB 保存数据时采用 TCP 协议,去掉 -z 参数即可,例如:(除非因防火墙、NAT穿透等问题导致 UDP 协议不可用,否则不建议使用 TCP 协议)
引用
/usr/local/dbcached/bin/memcached -d -m 256 -p 11211 -c 51200 -u nobody -x 192.168.0.2 -y 26010


  ● 如果想让 dbcached 作为普通的 Memcached 运行,去掉 -x、-y、-z 参数即可,例如:
引用
/usr/local/dbcached/bin/memcached -d -m 256 -p 11211 -c 51200 -u nobody



  2. QDBM & NMDB

  QDBM 和 NMDB 均为原版,可以从它们的官方网站下载最新版本。

  QDBM Installation (安装)
引用
wget http://qdbm.sourceforge.net/qdbm-1.8.77.tar.gz
tar zxvf qdbm-1.8.77.tar.gz
cd qdbm-1.8.77/
./configure --prefix=/usr
make
make install
cd ../


  NMDB Installation (安装)
引用
wget http://www.monkey.org/~provos/libevent-1.3e.tar.gz
tar zxvf libevent-1.3e.tar.gz
cd libevent-1.3e/
./configure --prefix=/usr
make && make install
cd ../

wget http://auriga.wearlab.de/~alb/nmdb/files/0.21/nmdb-0.21.tar.gz
tar zxvf nmdb-0.21.tar.gz
cd nmdb-0.21/
make BACKEND=qdbm ENABLE_TIPC=0 ENABLE_SCTP=0 install
cd ../


  Run as a daemon (作为守护进程运行)
引用
/usr/local/bin/nmdb -d /var/dbcached.db -t 26010 -T 192.168.0.2 -u 26010 -U 192.168.0.2 -c 1024

  ● -d 数据库路径(这里使用比 Berkeley DB 更快的 QDBM 数据库),例如 /var/dbcached.db

  ● -t TCP 监听端口 (默认:26010)

  ● -T TCP 监听地址 (默认:任何地址)

  ● -u UDP 监听端口 (默认:26010)

  ● -U UDP 监听地址 (默认:任何地址)

  ● -c 最大的缓存对象数目,单位为千 (默认:128)








技术大类 » Cache与存储 | 评论(68) | 引用(0) | 阅读(72692)
amna Email
2020-2-24 03:11
This is what commonly happens to the newbies in the business industry who do not know how to effectively market their product or service or service. healthzonetips.com
Human Resource Writing Services Homepage
2020-7-30 20:49
Human resource assignment writing services are not hard to come across for those in need of Human Resource Writing Services and human resource research paper writing services.
George Email Homepage
2020-8-20 17:21
If you ever heard about Hotmail, one of the first email service on the internet? All you need about this email service are on hotmail email login
Eleqtriki gamodzaxebit Email Homepage
2020-11-10 21:45
https://eleqtriki-gamodzaxebit.ge/
Eleqtriki gamodzaxebit Email Homepage
2020-11-10 21:46
itpdf Email Homepage
2020-11-18 21:25
hello, thanks for sharing <a href="https://itpdf.info/">itpdf</a>
john doctor Email
2021-4-1 18:00
We aim to make all our customers satisfy with our products. You will find a variety of Men's fashion ,<a href="https://newixfrancia.com/">Newixfrancia</a> fashion Women's cheap Louis Vuitton bags in our store at affordable price.Thinking of interesting ways to cost a milestone birthday? <a href="https://newixfrancia.com/">Newixfrancia</a>had one of the most distinctive distinctive celebrations.bakery along with living room operated by means of about three moment louis vuitton online Most effective Pastry Chef’s of the year Rammy Nominee Chef’s.
mike williams Email
2021-4-24 21:01
Is this project still under maintenance and development? In addition,<a href="https://www.aviatbilisi.com/">Aviabiletebi</a> suppose that the memory opened by memecache is 4G. Can the actual back-end persistence store excess data of 4G. Assuming that the cached data does not set the expiration time, it directly depends on the first-in, first-out method of ejecting the early data when it is full. Is the ejected cache still saved in the persistence?
mike william
2021-4-26 19:56
thanks for sharing this <a href="https://newixfrancia.com/">Télécharger pdf</a> really interesting and helpful post.
Lizy garcia Email
2021-5-13 23:45
Thank you so much for this excellent Post and all the best for your future. <a href="https://eleqtriki-gamodzaxebit.ge/">eleqtriki</a> I hope you and we will be sharing more thoughts and keep writing more like this one.
Ben johnson Email
2021-5-18 19:41
This info is worth everyone’s attention.https://natalinaumenko.com/ When can I find out more?
down or not Email Homepage
2021-8-9 18:21
Like big portions? If you began <a href="https://www.downstatuscheck.com/">down or not</a> ready your apartment, Coach Outlet  it's always best to consider the most effective way direct to the stage it could be to utilise your inventory throughout Coach Factory Outlet  concern, or maybe you basically won't destination stuff not enough.we're anti- whitening tray because Coach Outlet Online  i will be enjoy just get germ dog breeders
macivris xelosani Email Homepage
2021-8-14 15:50
e Epi Leather HandbagsLouis <a href="https://macivris-xelosani.ge/">მაცივრის ხელოსანი</a> Vuitton For Men HandbagsLouis Vuitton Damier Canvas WalletsLouis Vuitton Epi Leather WalletsLouis Vuitton Monogram Canvas WalletsLouis Vuitton Monogram Vernis WalleLouis Vuitton ShoesLouis Vuitton Men wallets.As the Authentic Louis Vuitton are so high-priced, so came the
Ieuan Ventura
2021-10-20 18:03
You have proven to be a reliable data and source for my project and you never disappoint me with your contents.  I cant wait for more of your thoughts. Good luck  สล็อต ฝาก-ถอน
BELA Email Homepage
2022-4-7 19:27
Great information, <a href="https://loginsport.nl/">loginsport.nl</a> I searched it and found your post, greatsmile
loges.com.se Email Homepage
2022-4-13 20:36
Cool you write, the information is very good and interesting <a href="https://loges.com.se/">loges.com.se</a> thanks for sharing
shz Email
2022-7-2 16:25
A great website with interesting and unique material what else would you need.  Lead generation
shz Email
2022-7-2 16:31
I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.  Lead generation
shz Email
2022-7-2 16:36
I feel a lot more people need to read this, very good info! .  Lead generation
shz Email
2022-7-2 16:39
Nice blog. Found this while searching through  Lead generation
分页: 3/4 第一页 上页 1 2 3 4 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]