Best Practice of Using Redis for an eCommerce Platform?

1,676 views
Skip to first unread message

Divyansh Guwalani

unread,
Apr 22, 2014, 9:22:49 AM4/22/14
to redi...@googlegroups.com

I have an eCommerce platform which has different Online Stores. Each Store has a different Unique ID.

Each Store contains categories.

  • Category has a name and id associated with it.
  • These categories can be sorted in order from the admin panel.

Each of the above category has a list of products.

  • These products might be in active or inactive state.

  • A product can be marked as featured so that it appears on the front page of the site. Rest are revealed by 'View All' or if you click on a particular category

  • Only the active ones are shown on the store front but both are shown in the admin panel.

  • A product has many attributes associated with it like Name, Price, Quantity, Options, Description. This will be stored in JSON format as the metadata

So consider that we will have a single Redis to store and server all the stores data. What would be the best nomenclature design of representing keys of Stores and their Categories and Products keeping in all the above points.

Andrew Button

unread,
Apr 23, 2014, 5:53:47 AM4/23/14
to redi...@googlegroups.com
Before getting into the detail of your post, I thought it would be good to clarify some points around using Redis for something like a product store.

As Redis is an in memory database the persistence model is based on either on saving regular snapshots of the memory to disk (BGSAVE), or by appending changes to a file (AOF). Some good information on this is available here:

http://redis.io/topics/persistence

Either way, to get the best out of Redis you don't want to have to fsync every change to disk as it slows things down. (Unless of course your churn of data is very low, then the impact of writing every change would be low.) But if you're not writing every change to disk immediately you have to accept the chance that some data will be lost in the event of a server or power failure etc. This may or may not be an issue for you depending on your particular scenario. Or it could be that Redis isn't your primary data store in which case you will have the data elsewhere. These are things that need to be considered when designing your data store.

Regarding the specifics of your question, were you thinking of using the Redis databases to separate your unique stores, or is this not possible?

How many categories and products are you likely to have?

Divyansh Guwalani

unread,
Apr 23, 2014, 10:15:20 AM4/23/14
to redi...@googlegroups.com
I want to move my data from mysql to some cache, so I thought redis would be a nice choice. This way my database will be quite free from load. Also I want to store and retrieve categories and products from any store easily, whenever I need it. I have around 200 to 300 stores.

The number of categories and products would be less than 30. I mean at most 10 categories, with each category having at most 20 to 30 products.

Josiah Carlson

unread,
Apr 23, 2014, 10:53:05 AM4/23/14
to redi...@googlegroups.com
I thought I sent this yesterday, but apparently it was hanging out in my drafts... anyway.

Based on your question, I believe you are best off using an object to Redis mapper to handle most of this for you. If you are using Python, I'd recommend mine: https://github.com/josiahcarlson/rom . If you aren't using Python, I'd recommend at least reading the freely downloadable chapter 8 of my book: http://manning.com/carlson/ (look for the link that reads "sample chapter 8"), which goes through some data modeling steps and a basic API for manipulating the data. Combine that with the first two sections of chapter 7 (not freely downloadable), and you get about 85% of what my Redis object mapper offers.

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages