Skip to content

[exporter/splunkhec] asynchronous HTTP request consumption #34259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Jul 26, 2024

Description:
only return the buffer to the pool after the HTTP request has been closed by the HTTP client

Link to tracking Issue:
Fixes #34255

Testing:
Tests pass. Performance tests show a large performance hit.

                                      │  before.txt  │               after.txt               │
                                      │    sec/op    │    sec/op     vs base                 │
_pushLogData_10_10_1024-10              91.11µ ± ∞ ¹   89.49µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_10_10_8K-10                76.62µ ± ∞ ¹   86.14µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_10_10_2M-10                79.62µ ± ∞ ¹   88.56µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_10_200_2M-10               1.528m ± ∞ ¹   1.707m ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_100_200_2M-10              14.37m ± ∞ ¹   15.10m ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_100_200_5M-10              14.18m ± ∞ ¹   16.03m ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_1024-10   597.9µ ± ∞ ¹   770.1µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_8K-10     136.3µ ± ∞ ¹   264.0µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_2M-10     136.1µ ± ∞ ¹   254.7µ ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_200_2M-10    3.064m ± ∞ ¹   3.547m ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_2M-10   30.55m ± ∞ ¹   31.86m ± ∞ ¹        ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_5M-10   30.30m ± ∞ ¹   31.35m ± ∞ ¹        ~ (p=1.000 n=1) ²
geomean                                 1.152m         1.389m        +20.64%
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

                                      │  before.txt   │                after.txt                 │
                                      │     B/op      │      B/op       vs base                  │
_pushLogData_10_10_1024-10              73.16Ki ± ∞ ¹    75.62Ki ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_10_10_8K-10                63.82Ki ± ∞ ¹    84.78Ki ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_10_10_2M-10                63.27Ki ± ∞ ¹   105.46Ki ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_10_200_2M-10               1.257Mi ± ∞ ¹    1.997Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_100_200_2M-10              12.60Mi ± ∞ ¹    18.51Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_100_200_5M-10              12.68Mi ± ∞ ¹    24.51Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_1024-10   2.417Mi ± ∞ ¹    3.191Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_8K-10     64.24Ki ± ∞ ¹   860.77Ki ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_2M-10     64.40Ki ± ∞ ¹   860.70Ki ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_200_2M-10    1.257Mi ± ∞ ¹    2.045Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_2M-10   12.54Mi ± ∞ ¹    13.42Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_5M-10   12.54Mi ± ∞ ¹    13.42Mi ± ∞ ¹         ~ (p=1.000 n=1) ²
geomean                                 848.1Ki          1.671Mi        +101.75%
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

                                      │  before.txt  │              after.txt               │
                                      │  allocs/op   │  allocs/op    vs base                │
_pushLogData_10_10_1024-10               821.0 ± ∞ ¹    828.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_10_10_8K-10                 716.0 ± ∞ ¹    726.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_10_10_2M-10                 709.0 ± ∞ ¹    721.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_10_200_2M-10               14.02k ± ∞ ¹   14.04k ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_100_200_2M-10              140.0k ± ∞ ¹   140.1k ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_100_200_5M-10              140.0k ± ∞ ¹   140.1k ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_1024-10    785.0 ± ∞ ¹    817.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_8K-10      709.0 ± ∞ ¹    738.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_10_2M-10      709.0 ± ∞ ¹    738.0 ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_10_200_2M-10    14.02k ± ∞ ¹   14.05k ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_2M-10   140.0k ± ∞ ¹   140.1k ± ∞ ¹       ~ (p=1.000 n=1) ²
_pushLogData_compressed_100_200_5M-10   140.0k ± ∞ ¹   140.1k ± ∞ ¹       ~ (p=1.000 n=1) ²
geomean                                 6.937k         7.033k        +1.38%


…P request has been closed by the HTTP client
@atoulme atoulme requested a review from dmitryax as a code owner July 26, 2024 00:16
@atoulme atoulme requested a review from a team July 26, 2024 00:16
if err := c.innerWriter.Close(); err != nil {
return err
}
return c.onClose()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onClose is nullable, so that call could result in a panic in case no closing hook has been attached

@atoulme atoulme force-pushed the fix_hec_body_request branch from cb940ed to 21a2739 Compare July 26, 2024 20:46
@atoulme
Copy link
Contributor Author

atoulme commented Jul 26, 2024

this is a costly issue. We might need to review a bit more the code and come up with a different approach.

@atoulme atoulme closed this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid gzip payload sent by splunk HEC exporter
3 participants