cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Data modelling question

khayes1
13-Aquamarine

Data modelling question

Hi,

I was wondering what peoples thoughts might be as the best way to achieve some data storage in my project.

I am trying to create a table to store how a customer wants the server to respond to certain events (i.e. via sms, email, no response etc.). Our remote assets produce a number of events types (c.30 different types) which are subscribed to on the platform. These are events things like 'Fault condition' 'User Login' 'Temperature too high'.

I am trying to create a mash up which will allow a customer to configure which events they wish to be notified about. So, my question is what would be the best way of storing their notification configuration? Assuming I have a datashape to describe the response for each event type, something like

What would be the best method to store the user defined configuration. Bearing in mind that there will be hundreds of customers, and that we might/will add more event types, which of the following should I use?

  1. Infotable of the above shape as property of each customer thing
  2. One Data Table for all customers, where each row would reflect the datashape above but include a customer id
  3. One data table for each customer
  4. Thingshape that has properties to encapsulate every event type and how the customer wishes to be notified. I could add this thingshape to the customer thing.

Thanks in advance.

5 REPLIES 5
PaiChung
22-Sapphire I
(To:khayes1)

I would probably go with either the InfoTable property of a Customer Thing or the DataTable.

A little more robust in a DataTable but response will be a bit slower.

khayes1
13-Aquamarine
(To:PaiChung)

Hi Pai,

thanks for the input. I have actually started down that road, but I was a little worried about using persistent infotables as I thought I'd read somewhere that it wasn't recommended to use infotables as properties of things?

PaiChung
22-Sapphire I
(To:khayes1)

Since InfoTables properties reside in the JVM it increases memory usage. However in your use case it doesn't sound like a lot of data.

wposner-2
12-Amethyst
(To:khayes1)

I'm assuming customers are actual TWX users (have a username and pw).  If so, you can simply add your infotable property to the UserExtensions Thing Shape and not have to worry about a custom customer thing.  But every time you have an event occur, you would need to loop through all your users to get their subscribed events and method of notification. 

I think it will be faster to store everything in a DT, and then for each event, query the DT for that event ID to get just the users subscribed to that event, along with their notification preference.  This quickly gives you a single IT to deal with that you can loop over and fire notifications based on the boolean preference selection rather than having to loop over every user, check if they're subscribed to the event and then do something.

Thing properties are sit in JVM so obivously it would raise performance isssues if the user count increases. so keeping infotable has a property is not advisable. If there is a way to categorize the user types then you can create streams for each category and keep the notification configuration information. Compare to datatable, stream will be having faster reponse since it is optomised and comes with default timestamp filters.

Top Tags