This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch increase-buffer
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git

commit bb7c5057dca582362d5ebcdcf73472fc3b3d3af4
Author: mrproliu <[email protected]>
AuthorDate: Thu Jun 5 21:17:44 2025 +0800

    Increase the transmit buffer size
---
 CHANGES.md                                        | 1 +
 bpf/include/queue.h                               | 2 +-
 bpf/include/socket_opts.h                         | 2 +-
 pkg/accesslog/collector/protocols/http1.go        | 4 ++--
 pkg/accesslog/events/data.go                      | 6 +++---
 pkg/profiling/task/network/analyze/events/data.go | 4 ++--
 pkg/tools/buffer/buffer.go                        | 8 ++++----
 7 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3781e06..ddcb4d5 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -25,6 +25,7 @@ Release Notes.
 * Downgrade the protocol of connection when protocol break in the access log 
module.
 * Bump up go version to `1.24` and eBPF library to `0.18.0`.
 * Support detect ztunnel environment in the inbound request.
+* Increase the transmit buffer size in the network profiling and access log 
module.
 
 #### Bug Fixes
 * Fix the base image cannot run in the arm64.
diff --git a/bpf/include/queue.h b/bpf/include/queue.h
index 559aeb4..c964c97 100644
--- a/bpf/include/queue.h
+++ b/bpf/include/queue.h
@@ -28,7 +28,7 @@ struct {
        __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
        __uint(max_entries, 1);
        __uint(key_size, sizeof(__u32));
-       __uint(value_size, 10240); // all events are less than 10KB
+       __uint(value_size, 30960); // all events are less than 30KB
 } rover_data_heap SEC(".maps");
 
 static __always_inline void *rover_reserve_buf(void *map, __u64 size) {
diff --git a/bpf/include/socket_opts.h b/bpf/include/socket_opts.h
index d506302..d66a0b3 100644
--- a/bpf/include/socket_opts.h
+++ b/bpf/include/socket_opts.h
@@ -43,7 +43,7 @@
 // for protocol analyze need to read
 #define MAX_PROTOCOL_SOCKET_READ_LENGTH 31
 // for transmit to the user space
-#define MAX_TRANSMIT_SOCKET_READ_LENGTH 2048
+#define MAX_TRANSMIT_SOCKET_READ_LENGTH 20480
 
 // unknown the connection type, not trigger the syscall connect,accept
 #define AF_UNKNOWN 0xff
diff --git a/pkg/accesslog/collector/protocols/http1.go 
b/pkg/accesslog/collector/protocols/http1.go
index 96064ff..b975d23 100644
--- a/pkg/accesslog/collector/protocols/http1.go
+++ b/pkg/accesslog/collector/protocols/http1.go
@@ -112,8 +112,8 @@ func (p *HTTP1Protocol) Analyze(connection 
*PartitionConnection, _ *AnalyzeHelpe
                        result = enums.ParseResultSkipPackage
                }
                if err != nil {
-                       http1Log.Warnf("failed to handle HTTP/1.x protocol, 
connection ID: %d, random ID: %d, data id: %d, error: %v",
-                               metrics.ConnectionID, metrics.RandomID, 
buf.Position().DataID(), err)
+                       http1Log.Warnf("failed to handle HTTP/1.x protocol, 
connection ID: %d, random ID: %d, data id: %d, type: %d, error: %v",
+                               metrics.ConnectionID, metrics.RandomID, 
buf.Position().DataID(), messageType, err)
                }
 
                http1Log.Debugf("readed message, messageType: %v, buf: %p, data 
id: %d, "+
diff --git a/pkg/accesslog/events/data.go b/pkg/accesslog/events/data.go
index 85bbd76..71b1a7e 100644
--- a/pkg/accesslog/events/data.go
+++ b/pkg/accesslog/events/data.go
@@ -38,10 +38,10 @@ type SocketDataUploadEvent struct {
        DataID0      uint64
        PrevDataID0  uint64
        TotalSize0   uint64
-       Buffer       [2048]byte
+       Buffer       [20480]byte
 }
 
-func (s *SocketDataUploadEvent) ReleaseBuffer() *[2048]byte {
+func (s *SocketDataUploadEvent) ReleaseBuffer() *[20480]byte {
        return &s.Buffer
 }
 
@@ -59,7 +59,7 @@ func (s *SocketDataUploadEvent) ReadFrom(r btf.Reader) {
        s.DataID0 = r.ReadUint64()
        s.PrevDataID0 = r.ReadUint64()
        s.TotalSize0 = r.ReadUint64()
-       r.ReadUint8Array(s.Buffer[:], 2048)
+       r.ReadUint8Array(s.Buffer[:], 20480)
 }
 
 func (s *SocketDataUploadEvent) Protocol() enums.ConnectionProtocol {
diff --git a/pkg/profiling/task/network/analyze/events/data.go 
b/pkg/profiling/task/network/analyze/events/data.go
index 3c59378..7aede33 100644
--- a/pkg/profiling/task/network/analyze/events/data.go
+++ b/pkg/profiling/task/network/analyze/events/data.go
@@ -37,10 +37,10 @@ type SocketDataUploadEvent struct {
        DataID0      uint64
        PrevDataID0  uint64
        TotalSize0   uint64
-       Buffer       [2048]byte
+       Buffer       [20480]byte
 }
 
-func (s *SocketDataUploadEvent) ReleaseBuffer() *[2048]byte {
+func (s *SocketDataUploadEvent) ReleaseBuffer() *[20480]byte {
        return &s.Buffer
 }
 
diff --git a/pkg/tools/buffer/buffer.go b/pkg/tools/buffer/buffer.go
index 5a2ed13..60ff2ab 100644
--- a/pkg/tools/buffer/buffer.go
+++ b/pkg/tools/buffer/buffer.go
@@ -40,13 +40,13 @@ var (
 
        PooledBuffer = sync.Pool{
                New: func() any {
-                       return &[2048]byte{}
+                       return &[20480]byte{}
                },
        }
 )
 
-func BorrowNewBuffer() *[2048]byte {
-       return PooledBuffer.Get().(*[2048]byte)
+func BorrowNewBuffer() *[20480]byte {
+       return PooledBuffer.Get().(*[20480]byte)
 }
 
 type SocketDataBuffer interface {
@@ -82,7 +82,7 @@ type SocketDataBuffer interface {
        // EndTime the data end timestamp
        EndTime() uint64
 
-       ReleaseBuffer() *[2048]byte
+       ReleaseBuffer() *[20480]byte
 }
 
 type SocketDataDetail interface {

Reply via email to