Hacker News new | past | comments | ask | show | jobs | submit login

Redis is probably the most useful tool powering the internet after nginx. It really is an amazing piece of engineering.



I have not used nginx, and have never heard of it spoken about in such glowing terms. Can you maybe compare/contrast it with apache?


The biggest difference is that nginx uses an evented I/O, and handles many connections per thread/process, Apache can only handle one at a time. This allows it to to use far less memory per connection, and lets it perform reasonably under very high loads. It also has very low latency, even for small loads, and is relatively easy to install and configure on most platforms.

nginx does an excellent job as a reverse proxy for applications, there are many configurations where nginx acts as a load balancer, and serves static content, and everything else is passed off to a real application. It's also useful if you're running on a tiny VPS with very little RAM.

However, Apache has a few features that nginx lacks, like embedding languages into it like mod_php does, and per directory configuration, in that directory.



I knew nginx was good for high loads but wasn't sure why and for what else. Makes sense, thanks a lot for the explanation.


>I have not used nginx, and have never heard of it spoken about in such glowing terms.

Seriously? There are lots of glowing blog posts, articles etc about Nginx all the time, including on HN. Just last week or so, it was reported that it powers the majority of the top-1000 biggest sites.


Yeah I guess what I mean was the post I was replying to called it the most useful tool powering the internet. I have not seen that before. I also like to ask people on HN who seem extremely passionate about something to explain why they are passionate because you often learn something new, that you often would not from articles etc.


nginx is fast and lightweight. Apache is a bloated mess in comparison. That's about it.


Late reply, but just saw this. So would you go as far as saying it never makes sense to use apache anymore? Is there any negative tradeoff to nginx?


You forgot the JVM.


Yup that, Eclipse, vi, Apache, MySQL and Oracle are my bread and butter. Never used nginx or Redis.


He said useful not ubiquitous.


Memcache?


Redis is memcache only better.


What's better about Redis? Many caching strategies require the storage to auto expire, memcache does this automatically. Redis does not do this (I believe). Is it significantly faster?


A simple Google search defeats your belief

http://redis.io/commands/set

> Options

> EX seconds -- Set the specified expire time, in seconds.

http://redis.io/commands/expireat

> EXPIREAT has the same effect and semantic as EXPIRE, but instead of specifying the number of seconds representing the TTL (time to live), it takes an absolute Unix timestamp (seconds since January 1, 1970)


In addition, the Redis config file allows you to specify an eviction policy when the maximum memory limit is reached:

  # volatile-lru -> remove the key with an expire set using an LRU algorithm
  # allkeys-lru -> remove any key accordingly to the LRU algorithm
  # volatile-random -> remove a random key with an expire set
  # allkeys-random -> remove a random key, any key
  # volatile-ttl -> remove the key with the nearest expire time (minor TTL)
  # noeviction -> don't expire at all, just return an error on write operations
Source: https://raw.github.com/antirez/redis/2.6/redis.conf


I apologize for not being specific. Setting timed expiration is not what I meant. Memcache will fill the entire cache and auto select items to be destroyed, based on current resource availability and order of entry into the cache (FIFO). I want that behaviour. I do not want to set and manage the time things expire.



It's all the functionality of memcache, plus persistence and data types like lists or sorted sets. You have much more control of your data.

It's the swiss army knife of in-memory data stores.


This[0] StackOverflow answer nicely lays this fact out.

[0]: http://stackoverflow.com/a/11257333/191438


Memcache is probably faster. But not as fast as writing data to /dev/null.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: