Jul 292013
 

I got a weird feeling that redis is more stable than memcached … but I don’t have solid evidence for that.

The case is, I migrated an application’s backend from memcached to redis, there were surely some other bug fixes and trivial performance tuning, but thinking of the memcached version had been running in production for more than 6 months without any significant problem, I wouldn’t think my changes make any big difference. Also, I changed my codes only, nothing to do with redis/memcached so I think it’s a fair comparison.

memcached use to hit 6GB memory (VIRT) usage after a week to 10 days running, then for most cases it will crash cos ops people set RAM limitation. Ops people asked me to do a restart once the memory utilization hit a certain level, but I found that restart memcached will simply wipe out all my in-memory-only data like counter, which is not critical but will make the application looks weird (“no more visitor in the past 7 days???”), and this initiated the migration to redis.

After migrated to redis, the memory utilization started from 4200MB, and one of the oldest instance had been running there since Jun 4 (50+ days till now), and memory is at 4300MB. I guess the increment was due to data size growth instead of memory leak, though again, I don’t have evidence.

Anyway, I’m not going to go back to memcached in the future, so the difference won’t bother me.

Feb 072012
 

I hit this problem in my project which is hadoop-based:

Cannot run program "chmod": java.io.IOException: error=12, Cannot allocate memory

Did some research but found nothing useful – everybody mentioned it’s JDK’s problem not using fork()+exec() which caused excessive memory allocated during spawning new process for running shell command. However, it’s weird that I hit this problem on my AWS micro instance only, not on my MacBook, so I moved on to check some more –

It turned out swap is a problem, my micro instance in AWS does not have swap enabled (i.e. zero swap space), after add 1G swap everything’s fine now.

I’m a Java newbie, so my question is, though it got solved, did I do something properly?