1

I've been looking into creating a notification system in PHP. Much like the one Facebook has got.

The applications is primarily running MySQL for data storage, however MySQL is way to slow for handling something such as notifications.

Here I was thinking Redis, since it's blazingly fast and very simple, and it allow entries to be deleted by themselves after a little while (which is exactly what I want). However I do have so concerns. I read the article Redis Persistence.

As I don't want to lose data and still get a fast experience from Redis, I was wondering what method to use? RDB or AOF or maybe even both? The speed is very important.

So what I'm asking

  • Is Redis a good choice for handling notifications?
  • Can I rely solely on using Redis for notifications?
  • Are there any better alternatives, apart from starting a new websever with node.js...?
  • What method is best for this, RDB or AOF, or both?

1 Answer 1

2
  • Redis is definitely a good choice for your use case
  • Yes you can solely rely on Redis for notifications as you will keep clearing it using expiry mechanism and hence data will remain of reasonable size. Also, my suggestion is to keep notifications associated with the activity id which is actually stored in database. So even in case of any mishap the actual data will be available in MySQL(along with timestamp of its creation).
  • You can use simple php redis client to build this system.
  • RDB in your case should suffice your need as actual activity stream data is anyways being stored in MySQL and data loss is not a very primary concern in such a scenario.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.