[ANN] Localmemcache-0.2.1: The beauty of memcached. For local data.Blazingly fast.

  • Thread starter Sven C. Koehler
  • Start date
S

Sven C. Koehler

Hi,

this release addresses some bugs that people were experiencing and brings
speed improvements.

===

Localmemcache that aims to provide an interface similar to memcached but for
accessing local data instead of remote data. It's based on mmap()'ed
shared memory for maximum speed.

* http://localmemcache.rubyforge.org/

===

Changes for 0.2.1:
* Fixed a bug that prevented setting values in the hashtable
* Accessing a closed memory cache does no longer result in a crash

* Speed improvements: On my machine localmemcache is now only about 20%
slower than Ruby's hash (0.2.0 was about 40% slower)
* OS X is now officially not supported as it lacks sem_timedwait and
sem_getvalue (You still can force a build but it won't be able to
recover from crashes.)
* The environment variable LMC_NAMESPACES_ROOT_PATH can now be used to
override the default, which is /var/tmp/localmemcache


EXAMPLE
=======

require 'localmemcache'
$lm = LocalMemCache.new :namespace => "viewcounters"
$lm[:foo] = 1
$lm[:foo]
$lm.delete:)foo)

INSTALL
=======

# gem install localmemcache

(In case rubyforge has not yet updated the mirrors, fetch the 0.2.1 gem
from here: http://github.com/sck/localmemcache/downloads and then do
# gem install localmemcache-0.2.1.gem )

CONTACT
=======

Please contact me with bugs, suggestions and patches at: schween + snafu # de

LINKS
=====

Localmemcache: http://localmemcache.rubyforge.org/
Rubyforge project: http://localmemcache.rubyforge.org/

Source code is hosted on github: http://github.com/sck/localmemcache/

Best,

Sven C. Koehler

4e25d2a677e6723f706d47da4dfd68cd localmemcache-0.2.1.gem
1658b6d660d64dbf57642789f49875e7 localmemcache-0.2.1.tar.gz
 
I

Iñaki Baz Castillo

El Domingo 05 Abril 2009, Sven C. Koehler escribi=F3:
Hi,

this release addresses some bugs that people were experiencing and brings
speed improvements.

Hi, I'm trying to install it in my 64 bits Ubuntu host with Ruby1.9.1=20
installed from sources in /usr/local.

This is the error output I get after doing "gem install localmemcache":


/usr/local/bin/ruby1.9 extconf.rb install localmemcache
checking for main() in -lrt... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=3D${opt-dir}/include
--with-opt-lib
--without-opt-lib=3D${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=3D.
--curdir
--ruby=3D/usr/local/bin/ruby1.9
--with-rtlib
--without-rtlib
/usr/local/lib/ruby1.9/1.9.1/mkmf.rb:362:in `try_do': The complier failed t=
o=20
generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:415:in `try_link0'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:419:in `try_link'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:527:in `try_func'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:723:in `block in=20
have_library'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:668:in `block in=20
checking_for'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:274:in `block (2 levels) =
in=20
postpone'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:248:in `open'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:274:in `block in postpone'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:248:in `open'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:270:in `postpone'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:667:in `checking_for'
from /usr/local/lib/ruby1.9/1.9.1/mkmf.rb:718:in `have_library'
from extconf.rb:13:in `<main>'


mkmf.log is empty. What could I check?
Thanks.

=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
I

Iñaki Baz Castillo

El Domingo 05 Abril 2009, Sven C. Koehler escribi=F3:
Hi,

this release addresses some bugs that people were experiencing and brings
speed improvements.

Now I've installed it in Ruby1.8 with no problem but I think there is=20
something wrong in the Gem.

Basically if I do:

=2D-------------
~# irb1.8
irb> require "localmemcache"
LoadError: no such file to load -- localmemcache
from (irb):5:in `require'
from (irb):5
=2D-------------

It makes sense since there is no "lib/localmemcache.rb" in the localmemcach=
e=20
gem directory.

The only way to load it is by doing:

=2D------------
~# cd /usr/lib/ruby/gems/1.8/gems/localmemcache-0.2.1/src/ruby-binding/
~# irb1.8
irb> require "localmemcache"
true
=2D------------

I understand that, for a normal Gem to work properly, it must create a=20
"gen_name.rb" in "GEMS_DIR/gen_name/lib/" (this is how all the rest of Gems=
=20
are installed), but localmemcache doesn't create a "lib" directory.

Regards.


=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
S

Sven C. Koehler

Now I've installed it in Ruby1.8 with no problem but I think there is
something wrong in the Gem.

Basically if I do:

--------------
~# irb1.8
irb> require "localmemcache"
LoadError: no such file to load -- localmemcache
from (irb):5:in `require'
from (irb):5

I just checked it with my ubuntu machine and it's fine for me. Most
likely you didn't load rubygems properly:

| sck@u:~/$ sudo gem install localmemcache
| Building native extensions. This could take a while...
| Successfully installed localmemcache-0.2.1
| 1 gem installed
| sck@u:~$ irb -rubygems
| irb(main):001:0> require 'localmemcache'
| => true
| irb(main):003:0> $:
| => ["/var/lib/gems/1.8/gems/localmemcache-0.2.1/bin", "/var/lib/gems/1.8/gems/localmemcache-0.2.1/src/ruby-binding", "/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_ruby/1.8/i486-linux", "/usr/local/lib/site_ruby/1.8/i386-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.8", "/usr/lib/ruby/vendor_ruby/1.8/i486-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.8", "/usr/lib/ruby/1.8/i486-linux", "/usr/lib/ruby/1.8/i386-linux", "."]

-S.
-
 
I

Iñaki Baz Castillo

El Lunes 06 Abril 2009, David Masover escribi=F3:
1.9 has gems loaded by default. 1.8 doesn't. Try:

require 'rubygems'
require 'localmemcache'

Sure you are right. Thanks for pointing it out.

=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
I

Iñaki Baz Castillo

El Lunes 06 Abril 2009, Sven C. Koehler escribi=F3:
I just checked it with my ubuntu machine and it's fine for me. Most
likely you didn't load rubygems properly:

Yes, sorry, I forgot to load rubygems in 1.8.

But there is still the issue with Ruby 1.9.1. It's a different issue.

Thanks.

=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
S

Sven C. Koehler

But there is still the issue with Ruby 1.9.1. It's a different issue.

Ok, I just released localmemcache-0.2.2 which should fix the problems
with Ruby 1.9.

| sck@u:~$ sudo gem install localmemcache
| Building native extensions. This could take a while...
| Successfully installed localmemcache-0.2.2
| 1 gem installed
| sck@u:~$ irb
| irb(main):001:0> require 'localmemcache'
| => true
| irb(main):002:0> $:
| => ["/var/lib/gems/1.9.0/gems/localmemcache-0.2.2/src/ruby-binding", "/var/lib/gems/1.9.0/gems/localmemcache-0.2.2/bin", "/usr/local/lib/site_ruby/1.9.0", "/usr/local/lib/site_ruby/1.9.0/i486-linux", "/usr/local/lib/site_ruby/1.9/i386-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.9.0", "/usr/lib/ruby/vendor_ruby/1.9.0/i486-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.9.0", "/usr/lib/ruby/1.9.0/i486-linux", "/usr/lib/ruby/1.9/i386-linux", "."]


-S.
 
I

Iñaki Baz Castillo

2009/4/6 Sven C. Koehler said:
Ok, I just released localmemcache-0.2.2 which should fix the problems
with Ruby 1.9.

Thanks, it works!

Just a question: Every data I save in localmemcache is converted to String:

irb> lm[:aaa]=3Dtrue
true
irb> lm[:bbb]=3D123
123
irb> lm[:aaa]
"true"
irb> lm[:bbb]
"123"

About the performance, even if localmemcache is just 20% slower than
Ruby Hash, I wonder which is the real performance taking into account
that all the returned values are String, so instead of:

if @do_action

I must do:

if $lm[:do_action] =3D=3D "true"


However, really thanks for this great utility. It allows for example
running 4 different processes of a Ruby programm in a quad-core CPU
sharing local memory :)



--=20
I=C3=B1aki Baz Castillo
<[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top