sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Crons lead to unusual 10% load increase

Open Angelodaniel opened this issue 1 year ago • 8 comments

Integration

sentry-spring-boot-starter-jakarta

Java Version

Spring boot 3.2.2

Version

7.2.0

Steps to Reproduce

spring boot application 3.2.2 annotation: @SentryCheckIn(value = "x", heartbeat = true) SDK version: io.sentry:sentry-spring-boot-starter-jakarta:7.2.0 Looks like that the gc_memory_promoted_bytes_total is much higher than usual

Expected Result

Not a big increase in load increase

Actual Result

I’ve noticed that enabling the cron SDK in our Spring Boot application leads to an unusual 10% load increase on one of the three instances in our cluster. This behavior is apparent even when the scheduler isn’t active, as it’s set to run in the morning. Screenshot 2024-01-25 at 15 18 29

┆Issue is synchronized with this Jira Improvement by Unito

Angelodaniel avatar Jan 25 '24 14:01 Angelodaniel

@Angelodaniel do you know if other Sentry annotations have been used before (e.g. @SentrySpan, @SentryTransaction) or if crons is the first AOP feature in use?

I'll try to reproduce and see if there's something we can do about it.

adinauer avatar Jan 26 '24 10:01 adinauer

@Angelodaniel is there only a single @Scheduled method that runs in the morning and nothing else?

adinauer avatar Jan 26 '24 10:01 adinauer

@Angelodaniel does this only happen when the server has been running for a while or can it be observed immediately?

adinauer avatar Jan 26 '24 10:01 adinauer

@Angelodaniel is the method annotated with @SentryCheckIn also called from other places? e.g. when a request is performed?

sorry for the many separate messages

adinauer avatar Jan 26 '24 10:01 adinauer

As a workaround, you could try to use CheckInUtils.withCheckIn instead of the annotation and see if that helps. See https://docs.sentry.io/platforms/java/crons/#check-ins-recommended

If that alone doesn't work, you might have to combine it with sentry.enable-aot-compatibility=true to disable AOP features. Be aware though this also disabled other Sentry annotations like @SentryTransaction and @SentrySpan.

adinauer avatar Jan 26 '24 12:01 adinauer

Hello, I can jump in here and answer your questions @Angelodaniel

@Angelodaniel do you know if other Sentry annotations have been used before (e.g. @SentrySpan, @SentryTransaction) or if crons is the first AOP feature in use?

I'll try to reproduce and see if there's something we can do about it.

Only the @SentryCheckIn was used.

@Angelodaniel is there only a single @Scheduled method that runs in the morning and nothing else? No we have multiple Scheduler running, but only one got the @SentryCheckIn Annotation.

@Angelodaniel is the method annotated with @SentryCheckIn also called from other places? e.g. when a request is performed? nope, only via Scheduler Annotation

@Angelodaniel does this only happen when the server has been running for a while or can it be observed immediately?

immediately

stockii avatar Jan 29 '24 11:01 stockii

@stockii thank you for your answers, we'll investigate and report back here.

adinauer avatar Jan 29 '24 13:01 adinauer

@stockii so far I haven't been able to confirm the load increase on our Spring Boot 3 sample. Have you had any luck with the workaround in https://github.com/getsentry/sentry-java/issues/3165#issuecomment-1912000869 ?

adinauer avatar Jan 30 '24 12:01 adinauer