-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve buffer reader speed. (#2188)
* 1. Sleep 500 milliseconds after a batch re-call finish. 2. Re-create register lock index when the system property named debug is setting. 3. Get the register inventory before lock to avoid increment the sequence but not use. 4. Return the exchange flag after all the references and spans in one segment parsed to reduce the number of segment parse. 5. Put the not exchanged segment into a collection then try to exchange no more than 10 times because of the exchange is asynchronous. 6. Cache the segment object to avoid repeated deserialization. #2185 * #2185 1. Sleep 500 milliseconds after a batch re-call finish. 2. Re-create register lock index when the system property named debug is setting. 3. Get the register inventory before lock to avoid increment the sequence but not use.
- Loading branch information
1 parent
9c08c3e
commit 8b50343
Showing
12 changed files
with
283 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...rary-buffer/src/main/java/org/apache/skywalking/oap/server/library/buffer/BufferData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.skywalking.oap.server.library.buffer; | ||
|
||
import com.google.protobuf.GeneratedMessageV3; | ||
import lombok.*; | ||
import org.apache.skywalking.apm.network.language.agent.TraceSegmentObject; | ||
import org.apache.skywalking.apm.network.language.agent.v2.SegmentObject; | ||
|
||
/** | ||
* @author peng-yongsheng | ||
*/ | ||
@Getter | ||
public class BufferData<MESSAGE_TYPE extends GeneratedMessageV3> { | ||
private MESSAGE_TYPE messageType; | ||
@Setter private TraceSegmentObject v1Segment; | ||
@Setter private SegmentObject v2Segment; | ||
|
||
public BufferData(MESSAGE_TYPE messageType) { | ||
this.messageType = messageType; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...r/src/main/java/org/apache/skywalking/oap/server/library/buffer/BufferDataCollection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.skywalking.oap.server.library.buffer; | ||
|
||
import com.google.protobuf.GeneratedMessageV3; | ||
import java.util.*; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
/** | ||
* @author peng-yongsheng | ||
*/ | ||
public class BufferDataCollection<MESSAGE_TYPE extends GeneratedMessageV3> { | ||
|
||
private AtomicInteger index = new AtomicInteger(0); | ||
private final List<BufferData<MESSAGE_TYPE>> bufferDataList; | ||
|
||
public BufferDataCollection(int size) { | ||
this.bufferDataList = new ArrayList<>(size); | ||
for (int i = 0; i < size; i++) { | ||
bufferDataList.add(null); | ||
} | ||
} | ||
|
||
public void add(BufferData<MESSAGE_TYPE> bufferData) { | ||
bufferDataList.set(index.getAndIncrement(), bufferData); | ||
|
||
} | ||
|
||
public int size() { | ||
return index.get(); | ||
} | ||
|
||
public synchronized List<BufferData<MESSAGE_TYPE>> export() { | ||
List<BufferData<MESSAGE_TYPE>> exportData = new ArrayList<>(index.get()); | ||
for (int i = 0; i < index.get(); i++) { | ||
exportData.add(bufferDataList.get(i)); | ||
} | ||
index.set(0); | ||
return exportData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.