EzDevInfo.com

redis interview questions

Top redis frequently asked interview questions

When to Redis? When to MongoDB?

What I want is not a comparison between Redis and MongoDB. I know they are different; the performance and the API is totally different.

Redis is very fast, but the API is very 'atomic'. MongoDB will eat more resources, but the API is very very easy to use, and I am very happy with it.

They're both awesome, and I want to use Redis in deployment as much as I can, but it is hard to code. I want to use MongoDB in development as much as I can, but it needs an expensive machine.

So what do you think about the use of both of them? When to pick Redis? When to pick MongoDB?


Source: (StackOverflow)

How can I stop redis-server?

I apparently have a redis-server instance running because when I try to start a new server by entering redis-server, I'm greeted with the following:

Opening port: bind: Address already in use

I can't figure out how to stop this server and start a new one.

Is there any command I can append to redis-server when I'm typing in the CLI?

My OS is Ubuntu 10.04.


Source: (StackOverflow)

Advertisements

Redis strings vs Redis hashes to represent JSON: efficiency?

I want to store a JSON payload into redis. There's really 2 ways I can do this:

  1. One using a simple string keys and values.
    key:user, value:payload (the entire JSON blob which can be 100-200 KB)

    SET user:1 payload

  2. Using hashes

    HSET user:1 username "someone"
    HSET user:1 location "NY"
    HSET user:1 bio "STRING WITH OVER 100 lines"

Keep in mind that if I use a hash, the value length isn't predictable. They're not all short such as the bio example above.

Which is more memory efficient? Using string keys and values, or using a hash?


Source: (StackOverflow)

How to use redis PUBLISH/SUBSCRIBE with nodejs to notify clients when data values change?

I'm writing an event-driven publish/subscribe application with NodeJS and Redis. I need an example of how to notify web clients when the data values in Redis change.


Source: (StackOverflow)

Redis: possible to expire an element in an array or sorted set?

Is it currently only possible to expire an entire key/value pair? What if I want to add values to a List type structure and have them get auto removed 1 hour after insertion. Is that currently possible, or would it require running a cron job to do the purging manually?


Source: (StackOverflow)

How can I use redis with Django?

I've heard of redis-cache but how exactly does it work? Is it used as a layer between django and my rdbms, by caching the rdbms queries somehow?

Or is it supposed to be used directly as the database? Which I doubt, since that github page doesn't cover any login details, no setup.. just tells you to set some config property.


Source: (StackOverflow)

Whats the advantage of using celery with rabbitmq over Redis, MongoDB or Django ORM)

Is there a speed advantage, functionality advantage?

Also using Django ORM (mysql), is it a lot slower than using rabbitmq, mongodb or redis?

Im currently hosting on webfaction, and installing erland and rabbit is both complicated, and from comments i read takes quite a bit of ram, so would just running celery with database be a smarter option? why or why not?


Source: (StackOverflow)

How do I delete everything in Redis?

I want to delete all keys. I want everything wiped out and give me a blank database.

Is there a way to do this in Redis client?


Source: (StackOverflow)

How to empty a redis database?

I've been playing with redis (and add some fun with it) during the last fews days and I'd like to know if there is a way to empty the db (remove the sets, the existing key....) easily.
During my tests, I created several sets with a lot of members, even created sets that I do not remember the name (how can I list those guys though ?).
Any idea about how to get rid of all of them ?


Source: (StackOverflow)

MongoDB with redis

Can anyone give example use cases of when you would benefit from using Redis and MongoDB in conjunction with each other?


Source: (StackOverflow)

node.js database [closed]

I'm looking for a database to pair with a node.js app. I'm assuming a json/nosql db would be preferable to a relational DB [I can do without any json/sql impedance mismatch]. I'm considering:

  • couchdb
  • mongodb
  • redis

Anyone have any views / war stories re compatiability/deployability of the above with node.js? Any clear favorites?


Source: (StackOverflow)

Redis key naming conventions?

What are the normal naming convention for keys in redis? I've seen values separated by : but I'm not sure what the normal convention is, or why.

For a user would you do something like...

user:00

if the user's id was 00

Are you able to query for just the beginning of the key to return all users?

I'm mainly just hoping to avoid any future problems by researching the ways that work for people and why they chose them.


Source: (StackOverflow)

Does name length impact performance in Redis?

I like to use verbose names in Redis, for instance set-allBooksBelongToUser:$userId.

Is this ok or does that impact performance?


Source: (StackOverflow)

How to remove debugging from an Express app?

I would like to remove the debugging mode. I am using express, redis, socket.io and connect-redis, but I do not know where the debugging mode comes from.

Node debug

Someone has an idea?


Source: (StackOverflow)

How do I move a redis database from one server to another?

I currently have a live redis server running on a cloud instance and I want to migrate this redis server to a new cloud instance and use that instance as my new redis server. If it were MySQL, I would export the DB from the old server and import it into the new server. How should I do this with redis?

P.S.: I'm not looking to set-up replication. I want to completely migrate the redis server to a new instance.


Source: (StackOverflow)