Skip to content
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

Memory issues with match on HTTP responses of SSE endpoints #370

Open
pavelsolomin opened this issue Feb 5, 2020 · 1 comment
Open

Memory issues with match on HTTP responses of SSE endpoints #370

pavelsolomin opened this issue Feb 5, 2020 · 1 comment

Comments

@pavelsolomin
Copy link

pavelsolomin commented Feb 5, 2020

Hello!

I use Tsung HTTP sessions to load test SSE endpoints of my Web application. At the moment, there seems to be no support for SSE sessions in Tsung, so, I do a "normal" HTTP GET to an SSE endpoint, and keep Tsung users stuck with open connections. So far, it was sufficient for my current needs, but I started getting Tsung memory issues with matchers.

Tsung version

$ $HOME/.asdf/bin/tsung -v
Tsung version 1.7.1_dev

Issue

When doing an HTTP GET to an endpoint with endless response like this:

                    <request subst="true">
                        <http url="%%_stream_url%%" method="GET" version="1.1">
                            <http_header name="Connection" value="keep-alive"/>
                            <http_header name="Content-Type" value="text/event-stream"/>
                        </http>
                    </request>

Tsung memory is stable

Screen Shot 2020-02-05 at 10 09 46 PM

But things change as soon as I add a matcher

                    <request subst="true">
                        <match do='restart' when='nomatch' name='03_get_stream_nomatch_200'>200</match>
                        <http url="%%_stream_url%%" method="GET" version="1.1">
                            <http_header name="Connection" value="keep-alive"/>
                            <http_header name="Content-Type" value="text/event-stream"/>
                        </http>
                    </request>

Tsung memory is always growing

Screen Shot 2020-02-05 at 10 11 29 PM

Expected behavior

When I do this:

<match do='restart' when='nomatch' name='03_get_stream_nomatch_200'>200</match>

I expect, given that status code arrives before the endless payload, that this matcher does not look for anything else besides the first line of an HTTP response.

I also expected Tsung to have some buffering of HTTP responses, such that it might deliver response data in chunks to the matcher, and not to keep loading the entire response forever. For example, curl http://localhost:4001/stream (example server code is attached) does not show such behavior of growing memory.

How to reproduce

I attached an archive with example SSE server and two Tsung scripts for reproducing this locally.

sse-example-server.tar.gz

I would also appreciate general suggestions regarding the approaches of using Tsung for my use case. I admit that using HTTP session is not ideal, there might be better ways to test SSE endpoints.

Thank you in advance.

@fatso83
Copy link

fatso83 commented Feb 24, 2020

I am also wondering a bit how to deal with SSE, as that is the main data transport channel for our SPA. If you ever publish more about your approach it would be great if you could add a pingback here (subscribing to this issue for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants