1

I am building a user activity notification system whereby each new notification message is created as a new node which is displayed by Views. To prevent an infinite number of nodes being created there is a system in place to delete notification nodes once they have reached a certain age.

This still begs the question however of whether using nodes in this way is a good idea for future performance. If a single user gets 20 notifications in a day, that is 20 nodes; now if there are potentially several hundred to a thousand users that is a lot of nodes in a short period of time. The main reason I use nodes is because they are easy to access and manipulate using Rules and also are very flexible when used with Views.

Therefore is it worth considering an alternative to nodes and if so what? The Messaging module comes to mind, but since each new Message is a new entity I'm not quite sure whether in terms of performance this would be any different to using nodes. Is there a module that offers the same flexibility of nodes but also has better performance?

3

There can be some performance issues because all your messages will be stored in the node table along with the other nodes. This will slow down any node loading or any kind of node type handling. I would suggest creating your own entity which would result in these being in their own table. They can also be referenced via entity reference and into views. Check out how to create entities and check out my entity feature on github.

  • Yeah that's what I'm concerned about. I have considered using ECK to build a custom "notification" entity, but the problem is that in D7 there is no standard way to add commenting to Entities. I am using nodes because they have comments already built in. – FrontEnd Aug 17 '14 at 7:24
  • 1
    That would be a downside to using a custom entity so you may have to resort to using a node, or build a comment type system using fields instead. – chadpeppers Aug 18 '14 at 14:40
  • Hmm I thought so. I may do things the other way around then and use nodes for only notifications but custom entities for everything else that doesn't need comments etc. – FrontEnd Aug 22 '14 at 12:55
4

I would go with Messaging. Dedicated Entity (if implement properly) is always faster than Node. I participated in the big D7 project and we were happy with Message API. By using a custom entity you can switch to custom storage, like: https://www.drupal.org/project/mongo_entity

This can be helpful for D8:

https://drupalwatchdog.com/blog/2015/3/entity-storage-drupal-8-way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.