Showing posts with label memory. Show all posts
Showing posts with label memory. Show all posts

Sunday, January 20, 2013

Couchbase support in Jamm!Memory

New storage

Jamm!Memory, PHP library with universal interface for best cachers (Redis, APC, Memcached), now have object for work with Couchbase - CouchbaseObject.
All features of this library are implemented in this class: tags, dog-pile and race-conditions protection, lock/acquire and others.
All code is test-covered, tested and even benchmarked. CouchbaseObject is not yet used in production, but I'm going to (see below).

Main feature of this storage is a fault-tolerance, of course.
While working on this code and testing it, I built cluster from few nodes and it was really simple. Server GUI is super user-friendly, has lot of monitoring things and control of nodes. Add new node in cluster is just  2 minutes (maybe less) plus time for rebalancing (it's going automatically and all data is available).

And next branch

Age of Jamm!Memory API is more than 2 years already. So I made branch 1.0, where currently placed all code of library, tested by unit-tests and by heavy usage in production for 2 years.
In next branch, 2.0, I will write refactored version of Jamm!Memory. API will be changed, all features will be saved, new features will be added. Some other storages maybe will be added (Riak, Cassandra).

Plans

I want to create another library, dedicated to Redis Cluster. It's in active development still, but it's time to write clients already :) It will be only key-value storage, but I hope it will as fast as existing Redis. I don't like that "Redis cluster sacrifices fault tolerance for consistence", but maybe it's just me and I don't understand something.

Also I hope Couchbase will have ability to turn off permanent writes to disk and will be able to copy data in background, so all writes and reads of data will be in memory. 
Please, support this idea by posting in forum thread.

In their forums I've created few themes and accidentally (I swear) whole column "last post" had become filled with my nickname :)

Also, I'm going to use Couchbase in production as a storage for cache, logs, sessions. This DB could be perfect for analytics (because of Map/Reduce), but it will require to write some GUI to show all these results. Currently used tool works only with RDBMS by ODBC. 

Monday, June 27, 2011

Redis in PHP Memory Cacher

New storage in PHP Memory Cacher: Redis
It's fast and stable.

Why Redis?
Because it's as fast as APC, data is accessible from php-cli and from mod_php (same as with using memcache), and all data are backed up on disk.
Last thing is very important - currently I store user's sessions in Redis and I don't afraid anymore to reboot my server.
Actually, backing up data on disk turns Redis from usual key-value storage to the BEST storage for data.

Why we love APC, Memcache as a key-value storages? Because they work fast. Especially APC.
What is their weak side? It's volatile storages because all data is stored in RAM only and RAM can be flushed easily. It's significant minus.
And Redis gives us pretty fast key-value storage (much faster than memcache) without that minus!

Even more: Redis has built-in abilities to work with lists, hashes, sets, even Pub/Sub channels. And it's not only "get/set" features, it's very useful and powerful features. So Redis can be used not only as a very fast key-value storage (even for canonical data), but as a database. We can work with data in different ways.

It's impresses me so much, my imagination is full of thoughts, how I can optimize data handling by using Redis - I'm going to write some kind of wrapper or ORM (don't know yet) in PHP to use Redis as database in my code. I use it already as a key-value cacher, but I want to move some data-algorithms from MySQL to Redis. I like MySQL (and SQL at all), but I know I can improve performance with Redis.

And already now you can check, how fast Redis works in my PHP Memory Cacher class :)