Skip to content

Commit 26ef911

Browse files
fix: async profiler max duration && reduce memory allocation when sending jfr (#733)
1 parent cb764a7 commit 26ef911

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/asyncprofiler/AsyncProfilerDataSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void sendData(AsyncProfilerTask task, File dumpFile) throws IOException,
100100
GRPC_UPSTREAM_TIMEOUT, TimeUnit.SECONDS
101101
).collect(new ClientResponseObserver<AsyncProfilerData, AsyncProfilerCollectionResponse>() {
102102
ClientCallStreamObserver<AsyncProfilerData> requestStream;
103+
final byte[] buf = new byte[DATA_CHUNK_SIZE];
103104

104105
@Override
105106
public void beforeStart(ClientCallStreamObserver<AsyncProfilerData> requestStream) {
@@ -111,7 +112,6 @@ public void onNext(AsyncProfilerCollectionResponse value) {
111112
if (AsyncProfilingStatus.TERMINATED_BY_OVERSIZE.equals(value.getType())) {
112113
LOGGER.warn("JFR is too large to be received by the oap server");
113114
} else {
114-
byte[] buf = new byte[DATA_CHUNK_SIZE];
115115
try {
116116
int bytesRead;
117117
while ((bytesRead = fileInputStream.read(buf)) != -1) {

apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ public static class AsyncProfiler {
262262

263263
/**
264264
* Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified.
265-
* default 10min.
265+
* default 20min.
266266
*/
267-
public static int MAX_DURATION = 600;
267+
public static int MAX_DURATION = 1200;
268268

269269
/**
270270
* Path for the JFR outputs from the Async Profiler.

apm-sniffer/config/agent.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ profile.dump_max_stack_depth=${SW_AGENT_PROFILE_DUMP_MAX_STACK_DEPTH:500}
166166
profile.snapshot_transport_buffer_size=${SW_AGENT_PROFILE_SNAPSHOT_TRANSPORT_BUFFER_SIZE:4500}
167167
# 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.
168168
asyncprofiler.active=${SW_AGENT_ASYNC_PROFILER_ACTIVE:true}
169-
# Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified. default 10min.
170-
asyncprofiler.max_duration=${SW_AGENT_ASYNC_PROFILER_MAX_DURATION:600}
169+
# Max execution time(second) for the Async Profiler. The task will be stopped even if a longer time is specified. default 20min.
170+
asyncprofiler.max_duration=${SW_AGENT_ASYNC_PROFILER_MAX_DURATION:1200}
171171
# 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.
172172
asyncprofiler.output_path=${SW_AGENT_ASYNC_PROFILER_OUTPUT_PATH:}
173173
# If true, the agent collects and reports metrics to the backend.

0 commit comments

Comments
 (0)