Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

do a session.save() every 1000 nodes?

Avatar

Level 2

Hello,

We have a custom cron job creating thousands of blueprint pages and rolling out to live copies in one session. We are not sure about the best practice of how often to save the session. Found this nice article AEM transaction size or “do a save every 1000 nodes” | Things on a content management system and seems it's also suggested by Adobe to do session.save() for every 1000 nodes. But we couldn't find real examples and documentation about how to implement this in custom code. We would like to get some help with a couple of questions from the AEM experts here:

1. what the "nodes" here referring to? cq:Page nodes only or including nt:unstructed nodes?

2. is there any API to get the number of pending (in transient and unsaved yet) nodes in current session?

PS. we are on AEM 6.2 SP1 CFP14.

Any advice and suggestions would be appreciated! Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 3

It is nodes, so every nt:unstructed is considered node.

If you install a large package in AEM, ul see saving approx 1024 nodes... So in AEM standard is 1024 node changes and then save.

You need to keep track of number of nodes your code creates/change, and check if changes > 1024 you then can do session.save().

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

It is nodes, so every nt:unstructed is considered node.

If you install a large package in AEM, ul see saving approx 1024 nodes... So in AEM standard is 1024 node changes and then save.

You need to keep track of number of nodes your code creates/change, and check if changes > 1024 you then can do session.save().