Wednesday, January 21, 2009

JsMemcached.js - A Jaxer client for memcached

Two days ago, on a lazy evening, I started work on my first solid Jaxer project — building a memcached client. As a testimony to the elegance of JavaScript, it took me less than 2 hours to get a basic memcached client up and running.

What is memcached, you ask? From the memcached website:

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

What it does is, lets you use excess RAM on your server machines as temporary stores of data, so that you can avoid going to your DB when you want frequently accessed data. Needless to say, accessing data from RAM is much faster. Since the creation of memcached for LiveJournal.com, memcached has become the cheapest and fastest way to scale a website.

Now, my implementation is not feature complete, nor at peak performance, but I aim to take it there. Even so, I decided to get my code out and available for everyone to see, so that people can tell me what they think of it.

You can go to the Google code page for the JsMemcached-client project, or download the code right away. Though limited in features and with a possible bug in an edge case in the get call, you can start using this already.

This is my first open-source project, so please don't be too harsh in your feedback.

Help needed: I need to figure out how to performance-optimize this code. Either I need to get rid of that loop in the get call, or I need to write a wrapper around libmemcached. I would prefer the latter, since I have to add more features for feature-completeness. Any idea on how I can get Jaxer to talk with libmemcached (or any other such out-of-process thing)?

19 comments:

Anonymous said...

Rakesh,

davey from aptana here, nice work, i develop the javascript framework for jaxer, if you post a link for this on the jaxer forums, i'm contact you via a pm and hopefully help you move forward with you lib.

again nice work.

cheers

Anonymous said...

Doh!

link to the forums, in case you dont have it at hand.

http://forums.aptana.com/viewforum.php?f=51

Jarret said...

Rakesh,

How do you prevent malicious users from calling these methods on their own and filling your server with bad data? Or am I not understanding the jaxer stack?

Pretty cool idea!

Rakesh Pai said...

jminkler,

Jaxer is a "environment" for running JavaScript on the server. JsMemcached is design to run only on the server. The user doesn't ever have access to this library in the browser.

Chaitanya Gupta said...

Does it handle binary data?

Rakesh Pai said...

CG,

Right now, no. I think I'll be adding the ability to parse binary data in the next release.

I am just concerned about performance, because of the way I'll have to read binary data from the server. Once I crack that, it'll be in trunk.

omega said...

Impressive!

BEST SITE said...

"MY PROGRAMMER IS TRYING TO CONVINCE ME TO MOVE TO .NET
FROM PHP. I HAVE ALWAYS DISLIKED THE IDEA BECAUSE OF THE EXPENSES.
BUT HE'S TRYING NONE THE LESS. I'VE BEEN USING WORD PRESS ON A NUMBER OF WEBSITES
FOR ABOUT A YEAR AND AM NERVOUS ABOUT SWITCHING TO ANOTHER PLATFORM.
I HAVE HEARD GREAT THINGS ABOUT BLOG ENGINE IS THERE A
WAY I CAN TRANSFER ALL MY WORD PRESS POSTS INTO IT? ANY KIND OF HELP WOULD BE GREATLY APPRECIATED!"

야설
오피헌터
외국인출장
마사지
카지노

slotmachine777.site said...

Hi there, the whole thing is going well here and of course everyone is sharing information, that’s really fine, keep up writing. 슬롯머신사이트

sportstotohot.com said...

Very interesting information!Perfect just what I was looking for!
토토사이트

Anonymous said...

Thanks for sharing this great site Class-Action-Lawsuits

Anonymous said...

You have clearly put in an enormous amount of work. Well done. Very informative. Thanks Sec Lawsuit

Anonymous said...

I love seeing this in here and would like to read more! Sec Law 360

Anonymous said...

GREAT POST
https://chancecdxm696.exposure.co/forget-bluegreen-lawsuit-settlement-3-replacements-you-need-to-jump-on?source=share-chancecdxm696

Anonymous said...

This is important, though it's necessary to help you head over to it weblink: https://canvas.instructure.com/eportfolios/1417012/rowanueip163/11_Faux_Pas_That_Are_Actually_Okay_To_Make_With_Your_Stock_Broker_Fraud_Attorney

Exterior Building Washing Services said...

Nice! This is a powerful story for me. Thanks a lot for sharing with us!

Siridgm said...

Sharing real-world applications and best practices in data science. Let's turn data into knowledge!

data science course in nagpur

Angel17 said...

This is so awesome. Thanks for sharing. condensing water heater seattle

Jessica Vanessa said...

JsMemcached.js - A Jaxer client for memcached is the best and there are a lot of people who need help. Also, you can look here or the best ideas that are providing us the right solutions.

ShareThis