Best Practices at a Glance for Building ThingWorx Solutions
Consider the following best practices when you build your IoT solution:
Include entities in a project. Use only one project for one solution.
Tag entities with model tags.
Make all extension entities non-editable.
Create localization tokens for all user interface labels.
Use JavaScript for implementing services.
Use Thing Shapes to define services and properties.
Use a unique namespace prefix for entity names, properties, and services.
Define organizations and user groups for entities to set visibility and permissions.
Split large solutions into smaller extensions.
Do not use fixed asset Things to execute services in mashups. Asset Things should be dynamically selected or looked up, and then their services should be executed.
* 
To avoid problematic scenarios, use the services of helper or manager Things. These services take the name of an asset Thing as the input parameter that is further used in mashups.
Leave the Execute Events Sequentially checkbox clear in the Thing Subscriptions as it requires more CPU resources. Use the Execute Events Sequentially subscription capability only if you need to run the subscription’s execution one after another. If necessary, use the JSONState object to keep data between the ordered subscription’s executions.
Use UpdatePropertyValuesBatched and UpdateSubscribedPropertyValuesBatched new services if updating more than one property for the same timestamp.
Review your ordered subscription script to ensure you do not keep excessive data in the state. If the limit is set too low, increase it using the SubscriptionsStatesMaxDirectMemorySize setting in the SubscriptionSettings section of platform-settings.json Configuration Details. The metrics described in Subscription Performance allow you to track the current size of the subscription state storage.
* 
When the subscription states storage size limit is reached, old states will be cleared as new states get saved. Error messages, such as the following, will appear in ApplicationLog:
Memory size limit exceeded, dropped state for key [RemoteRouter-1:Thing1:Template1:ThingTemplate:Subscription1]
Was this helpful?