Can I get Memcached running on a Windows (x64) 64bit environment?

C#C++Windows64 BitMemcached

C# Problem Overview


Does anyone know IF, WHEN or HOW I can get Memcached running on a Windows 64bit environment?

I'm setting up a new hosting solution and would much prefer to run a 64bit OS, and since it's an ASP.Net MVC solution with SQL Server DB, the OS is either going to be Windows Server 2003 or (hopefully!) 2008.

I know that this could spill over into a debate regarding 32bit vs 64bit on servers, but let's just say that my preference is 64bit and that I have some very good reasons.

So far, I've tried a number of options and found a bit of help related to getting this up on a 32bit machine (and succeeded I might add), but since the original Windows port is Win32 specific, this is hardly going to help when installing as a service on x64. It also has a dependency on the libevent for which I can only get a Win32 compiled version.

I suspect that simply loading all this up in C++ and hitting "compile" (for 64bit) wouldn't work, not least because of the intricate differences in 32 and 64bit architectures, but I'm wondering if anyone is working on getting this off the ground? Unfortunately, my expertise lie in managed code (C#) only, otherwise I would try and take this on myself, but I can't believe I'm the only guy out there trying to get memcached running on a 64 bit Windows server....am I?


Update

Yes I'm afraid I'm still looking for an answer to this - all my efforts (with my pathetic C++ skills) to make a stable build have failed - I've trashed one server and 3 VM's just trying it out so now I turn to the real experts. Is anyone planning on porting this to 64bit? Or are you really suggesting that I use MS Velocity instead? I shudder at the thought.


Update: @Lars - I do use Enyim actually - it's very good, but what you're referring to is a client, rather than the server part.

@DannySmurf - I've only been able to install it as a service on a 32 bit OS. 64 bit OS rejects the installation of this Win32 service. Of course yes, lots of Win32 code works seamlessly on x64 architecture, hence you can run 32bit apps (like Office for instance) or games on Vista/XP 64 etc, but this doesn't translate directly when it comes to services. I'm no expert, I suspect that it has to do with the syncs or eventing that services need to subscribe to, and I suspect that 64 and 32 don't play nicely. I'm happy to be corrected on any of this, but to answer your question - yes I have tried.

@OJ - thanks very much for the straight-forward response. I thought as much, but wasn't sure if anyone else had suggestions or had already gone down this route. Maybe when StackOverflow is LIVE, then more people will respond and let me know if this is something being looked into, and although I can try and compile it myself - I simply can't "trust" (with my C++ experience level) that it would provide "Enterprise Level" reliability in such a crucial component of large scalable solutions. I think it would need educated intervention rather than my unsanitised experimental approach before I could be confident. One little oversight on my part, could bring the site down. Oh well... till next time.

C# Solutions


Solution 1 - C#

North Scale labs have released a build of memcached 1.4.4 for Windows x64:

http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

http://labs.northscale.com/memcached-packages/

UPDATE: they have recently released Memcached Server - still FREE but enhanced distro with clustering, web-based admin/stats UI etc. (I'm not related to them in any way) Check it out at http://northscale.com/products/memcached.html and download at: http://www.northscale.com/download.php?a=d

UPDATE 2: NorthScale Memcached is no longer available as a standalone download. Now they have made it part of their commercial No-SQL DB offering called Membase. It can be configured to run in Memcached-only mode (i.e. without persistence) and there's a 100% free version too. Check it out here: http://www.membase.org/downloads

UPDATE 3: MemBase has slept with CouchDB and produced a hybrid product offering, called CouchBase. They still do offer a free "Community" version at http://www.couchbase.com/download

Solution 2 - C#

Just so people know, the 32-bit and 64-bit version as build by the good people from membase/couchbase/whatever is still available the blog URL has changed though:

32-bit binary of memcached 1.4.4 as Windows-service:

http://blog.couchbase.com/memcached-144-windows-32-bit-binary-now-available

http://s3.amazonaws.com/downloads.northscale.com/memcached-win32-1.4.4-14.zip

64-bit binary of memcached 1.4.4 as Windows-service:

http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

http://s3.amazonaws.com/downloads.northscale.com/memcached-win64-1.4.4-14.zip

The 64-bit version does have the wrong uptime.

So maybe you want this binary of 1.4.2 instead:

http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/

The 32-bit version as included with MemCacheDManager also suppors running on Windows 2000 (no IPv6):

http://allegiance.chi-town.com/MemCacheDManager.aspx http://allegiance.chi-town.com/Download.aspx?dl=Releases/MemCacheDManager_1_0_3_0.msi&rurl=MemCacheDManager.aspx

To unpack the msi:

msiexec /a Releases_MemCacheDManager_1_0_3_0.msi /qb TARGETDIR=c:\memcached

Solution 3 - C#

Memcached 1.4.5 binary for win x64 can be found here: http://downloads.northscale.com/memcached-1.4.5-amd64.zip

Another option would be to install Couchbase Server 1.8.0 x64 from here: http://www.couchbase.com/download, the bundled memcached seems to be version 1.7.1.1 (sounds like an internal version, I can't tell which is the real one)

As for running memcached as a service, this tutorial might be enough:

http://www.richardnichols.net/2010/08/install-memcached-on-windows-server/

Solution 4 - C#

Up-to-date Binaries

NorthScale has really old versions (the newest is 1.4.5 which is from April 2010) but there's a guy who offers 64-bit Memcached binaries for Windows compiled using Cygwin (but they don't require it installed) in his GitHub repository github.com/nono303/memcached.

For example, the binaries of the most recently released version (as of writing this answer) 1.5.16 are here. There're both 32 and 64-bit versions.

Memcached as a Windows Service

If you want to install it as a Windows service, you can use for example the open-source Non-Sucking Service Manager:

nssm install memcached c:\path\to\memcached.exe
nssm start memcached

See the documentation for details.

Solution 5 - C#

I have an memcached-1.2.1 for win32 originally downloaded from here: http://jehiah.cz/projects/memcached-win32/ (but now for some reason it is a broken link).

This is how I managed to run memcached for Win32 on Windows Server 2008 R2, 64 bit. memcached.exe -> properties -> Compatibility -> Run this program in compatibility mode for: Windows XP (SP 3). Notice that the user Uriel Katz mention in this discussion that this method restricted to 2GB memory of use.

Solution 6 - C#

I personally feel that you'd have to recompile the application using a 64-bit compiler (obviously on a 64-bit machine) to get the most of Memcached on a 64-bit platform. This may not be an easy task depending on the code. If it was written with 64-bit portability in mind then it could be a simple recompile. If it hasn't, then you could well be up for quite a bit of patching before getting it to build.. and then you'd have to verify that you haven't broken anything!

I don't think you're overestimating the differences between 32 and 64-bit at all. A common mistake is to assume that the job is a simple recompile when in fact it isn't. There are more portability issues than most people realise. Just because the application builds and you end up with a binary, it doesn't mean that the binary is going to behave as it should. Especially when it may interact with other 32-bit code.

Having said that, it might be worth giving it a spin!

Good luck. Cheers!


@Lars: I recommend reading the question before attempting an answer.

@John Sibly & @DannySmurf: given the nature of Memcached and what it aims to achieve, surely you wouldn't want to run a 32-bit version on a 64-bit machine? If you had a 64-bit capable machine it would make sense to run a 64-bit version to make the most of the features of the hardware.

Solution 7 - C#

I was just searching for memcached on a 64bit Windows system and found this. So far there isn't any Win64 memcached version. But I just started the memcached.exe with the appropriate commands via cmd and it's just running fine. I'm using Windows Vista 64bit, don't know if there are any differences between Vista and the server versions.

Kindest regards Fleshgrinder

Solution 8 - C#

Dude, Codeplex is your friend -> check out this port of it. It used to have a 64bit release, but u can either download the latest and compile for 64bit (pretty easy) or check the previous releases.

Solution 9 - C#

The 32 bit version run on 64 bit via WOW64 but the process is still limited to 2GB,with a 64-bit version you can go beyond that to more than a single machine will have.

Solution 10 - C#

Are you sure that the 32-bit version doesn't just run on 64-bit Windows, without modification? Most things do.

Failing that, have you actually tried just compiling it for 64-bit? A brief scan of a few Google Groups etc where people asked this same question suggests that that may be exactly the solution to this. I think you're probably overestimating the difference between 32-bit and 64-bit Windows (at least as far as compiling a native application goes).

Solution 11 - C#

FYI, I couldn't get the 64 bit version (from here http://labs.northscale.com/memcached-packages/) to install as a service until I ran memcached as administrator.

I just went to the executable's properties, then the Compatibility tab, and checked "Run this program as an administrator" (There a ton of other ways to do this, but it seemed simplest)

Then I was finally able to successfully run: memcached -d install

Don't forget to start the service after it is installed too :)

Solution 12 - C#

You could always run multiple instances of 32-bit memcached processes on one box, allowing that machine to serve a total of > 2GB memcache space.

Solution 13 - C#

If this can help, I've done a wrapper based on a compilation of memcached 1.4.5 64-bits found through this page (direct link to NorthScale binary).

It's a windows service and it works perfectly well in a production environment:
https://github.com/eric-b/MemcachedService64

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobertTheGreyView Question on Stackoverflow
Solution 1 - C#Andriy VolkovView Answer on Stackoverflow
Solution 2 - C#LennieView Answer on Stackoverflow
Solution 3 - C#alexandrulView Answer on Stackoverflow
Solution 4 - C#David Ferenczy RogožanView Answer on Stackoverflow
Solution 5 - C#jim77View Answer on Stackoverflow
Solution 6 - C#OJ.View Answer on Stackoverflow
Solution 7 - C#FleshgrinderView Answer on Stackoverflow
Solution 8 - C#Pure.KromeView Answer on Stackoverflow
Solution 9 - C#Uriel KatzView Answer on Stackoverflow
Solution 10 - C#TheSmurfView Answer on Stackoverflow
Solution 11 - C#Jasper RosenbergView Answer on Stackoverflow
Solution 12 - C#KenView Answer on Stackoverflow
Solution 13 - C#Eric BoumendilView Answer on Stackoverflow