AMPscript Best Practices Part 2: Planning for Performance
This is the second post in the AMPscript best practices series. If you haven't read the first post yet, you can access it here.
Poorly coded AMPscript can have a negative impact on the performance of your sends. Not only can it affect your own sends, but it can also impact the sends of other users in the Salesforce Marketing Cloud. Let me explain.
The Salesforce Marketing Cloud follows a tenant-based architecture, which means multiple users share the same database. If one of your sends causes a spike in database usage, it can impact the performance of other users' sends as well. Therefore, it's crucial to consider the performance implications of your code.
Here are some key points to keep in mind for optimizing AMPscript performance:
- Avoid making HTTP calls from emails if possible. If you must make them, ensure that the external server can handle the expected volume.
- Functions that can impact send speeds:
- TreatAsContent
- Lookup[Rows]
- EncryptSymmetric
- Update/Insert/UpsertDE
- HTTPGet (consider using the cache option)
- CreateSalesforceObject/RetrieveSalesforceObjects/UpdateSingleSalesforceObject
- Data Manipulation:
- Limit the number of lookup functions based on your send audience size.
- Use LookupRows to limit to one lookup function per data extension (DE).
- Use LookupOrderedRows to limit the data being returned.
- Build precise WHERE clauses with filter conditions, utilizing indexed DE attributes whenever possible.
- Apply data retention periods to remove redundant data from DEs.
- Use data retention on send logs or move old send log data to Send Log Archive DEs.
- Consider using functions like RaiseError and exclusion scripts only if you can't determine to send attribute values during segmentation.
The next post here is about best practices that help in maintaining the AMPscript code.
No comments:
Post a Comment