fix: async profiler max duration && reduce memory allocation when sending jfr (#733)

This commit is contained in:
zhengziyi0117 2024-12-02 16:12:12 +08:00 committed by GitHub
parent cb764a7849
commit 26ef911aea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -100,6 +100,7 @@ public class AsyncProfilerDataSender implements BootService, GRPCChannelListener
GRPC_UPSTREAM_TIMEOUT, TimeUnit.SECONDS
).collect(new ClientResponseObserver<AsyncProfilerData, AsyncProfilerCollectionResponse>() {
ClientCallStreamObserver<AsyncProfilerData> requestStream;
final byte[] buf = new byte[DATA_CHUNK_SIZE];
@Override
public void beforeStart(ClientCallStreamObserver<AsyncProfilerData> requestStream) {
@ -111,7 +112,6 @@ public class AsyncProfilerDataSender implements BootService, GRPCChannelListener
if (AsyncProfilingStatus.TERMINATED_BY_OVERSIZE.equals(value.getType())) {
LOGGER.warn("JFR is too large to be received by the oap server");
} else {
byte[] buf = new byte[DATA_CHUNK_SIZE];
try {
int bytesRead;
while ((bytesRead = fileInputStream.read(buf)) != -1) {

View File

@ -262,9 +262,9 @@ public class Config {
/**
* Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified.
* default 10min.
* default 20min.
*/
public static int MAX_DURATION = 600;
public static int MAX_DURATION = 1200;
/**
* Path for the JFR outputs from the Async Profiler.

View File

@ -166,8 +166,8 @@ profile.dump_max_stack_depth=${SW_AGENT_PROFILE_DUMP_MAX_STACK_DEPTH:500}
profile.snapshot_transport_buffer_size=${SW_AGENT_PROFILE_SNAPSHOT_TRANSPORT_BUFFER_SIZE:4500}
# If true, async profiler will be enabled when user creates a new async profiler task. If false, it will be disabled. The default value is true.
asyncprofiler.active=${SW_AGENT_ASYNC_PROFILER_ACTIVE:true}
# Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified. default 10min.
asyncprofiler.max_duration=${SW_AGENT_ASYNC_PROFILER_MAX_DURATION:600}
# Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified. default 20min.
asyncprofiler.max_duration=${SW_AGENT_ASYNC_PROFILER_MAX_DURATION:1200}
# Path for the JFR outputs from the Async Profiler. If the parameter is not empty, the file will be created in the specified directory, otherwise the Files.createTemp method will be used to create the file.
asyncprofiler.output_path=${SW_AGENT_ASYNC_PROFILER_OUTPUT_PATH:}
# If true, the agent collects and reports metrics to the backend.