Our team ran into a problem while using the typescript sdk.
We needed to use the heartbeat in a long-running activity. But when we use Context.current().heartbeat() inside a long-lived activity (this is a loop that collects information on an arbitrary number of objects for the user), we observe increased cpu consumption, especially during periods of high load from our users.
To be precise - during idle consumption increased by 1.5-2 times (from 0.1 cpu to 0.2 cpu). During periods of high load - up to 0.6 cpu(3-4 times), while without the use of heartbeat, the load did not exceed 0.1 cpu.
The usage of heartbeat was carried out according to the documentation - Activities in TypeScript | Temporal Documentation
Have you met with a similar problem? We will be very grateful for your help
By high load, do you mean there are many concurrent long-running activities? Are heartbeats always sent on the same schedule? How many hearbeating activities correspond with the 60% CPU load?
Which SDK version? There were some changes recently in the way we manage heartbeats.
Many concurrent workflows, each of them is run for a separate user. Now its about >50 active worflows, which are scheduled by cron every day. Each workflow starts long-running activity, which sequentially collects data about some user objects (from 1 to 100 - depends on user)
temporalio - 0.16.2
We start to use it about 7 month ago. Since then we have moved to golang sdk, but we still have important part of infrastructure, which uses ts-sdk
CPU usage may be reduced if you upgrade to latest (
Thank you. I will try to update the version of sdk