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

Explicitly nil the agent connection if caching is disabled. #22

Merged

Conversation

sokkojohnny1
Copy link
Contributor

Explicitly nil the agent connection if caching is disabled

With caching disabled, every alternating metric send fails because it will be attempted on a closed connection - this was the cause of the 50% throughput issue @obfuscurity reported.

master:

$ ./haggar -agents=3 -metrics=1 -carbon=localhost:2003 -cache_connections=false
2017/01/01 21:28:43 master: pid 36203
2017/01/01 21:28:43 agent 0: launched
2017/01/01 21:28:53 agent 0: flushed 1 metrics
2017/01/01 21:28:55 agent 1: launched
2017/01/01 21:29:03 agent 0: write tcp 127.0.0.1:63932->127.0.0.1:2003: use of closed network connection
2017/01/01 21:29:05 agent 2: launched
2017/01/01 21:29:05 agent 1: flushed 1 metrics
2017/01/01 21:29:13 agent 0: flushed 1 metrics
2017/01/01 21:29:15 agent 2: flushed 1 metrics
2017/01/01 21:29:15 agent 1: write tcp 127.0.0.1:63934->127.0.0.1:2003: use of closed network connection

fix-cached-connection-nil-check:

$ ./haggar -agents=3 -metrics=1 -carbon=localhost:2003 -cache_connections=false
2017/01/01 21:30:00 master: pid 35558
2017/01/01 21:30:00 agent 0: launched
2017/01/01 21:30:10 agent 0: flushed 1 metrics
2017/01/01 21:30:12 agent 1: launched
2017/01/01 21:30:20 agent 0: flushed 1 metrics
2017/01/01 21:30:22 agent 2: launched
2017/01/01 21:30:22 agent 1: flushed 1 metrics
2017/01/01 21:30:30 agent 0: flushed 1 metrics
2017/01/01 21:30:32 agent 2: flushed 1 metrics
2017/01/01 21:30:32 agent 1: flushed 1 metrics

fixes #21

@sokkojohnny1 sokkojohnny1 force-pushed the fix-cached-connection-nil-check branch from 8553f16 to 001dd20 Compare January 2, 2017 04:05
With caching disabled, every alternating metric send fails because it will be attempted on a closed connection - this was the cause of the 50% throughput issue @obfuscurity reported.

master:

```
$ ./haggar -agents=3 -metrics=1 -carbon=localhost:2003 -cache_connections=false
2017/01/01 21:28:43 master: pid 36203
2017/01/01 21:28:43 agent 0: launched
2017/01/01 21:28:53 agent 0: flushed 1 metrics
2017/01/01 21:28:55 agent 1: launched
2017/01/01 21:29:03 agent 0: write tcp 127.0.0.1:63932->127.0.0.1:2003: use of closed network connection
2017/01/01 21:29:05 agent 2: launched
2017/01/01 21:29:05 agent 1: flushed 1 metrics
2017/01/01 21:29:13 agent 0: flushed 1 metrics
2017/01/01 21:29:15 agent 2: flushed 1 metrics
2017/01/01 21:29:15 agent 1: write tcp 127.0.0.1:63934->127.0.0.1:2003: use of closed network connection
```

fix-cached-connection-nil-check:

```
$ ./haggar -agents=3 -metrics=1 -carbon=localhost:2003 -cache_connections=false
2017/01/01 21:30:00 master: pid 35558
2017/01/01 21:30:00 agent 0: launched
2017/01/01 21:30:10 agent 0: flushed 1 metrics
2017/01/01 21:30:12 agent 1: launched
2017/01/01 21:30:20 agent 0: flushed 1 metrics
2017/01/01 21:30:22 agent 2: launched
2017/01/01 21:30:22 agent 1: flushed 1 metrics
2017/01/01 21:30:30 agent 0: flushed 1 metrics
2017/01/01 21:30:32 agent 2: flushed 1 metrics
2017/01/01 21:30:32 agent 1: flushed 1 metrics
```

fixes gorsuch#21
@gorsuch
Copy link
Owner

gorsuch commented Jan 2, 2017

<3

Thank you @sokkojohnny1!

@gorsuch
Copy link
Owner

gorsuch commented Jan 2, 2017

Verified locally.

@gorsuch gorsuch merged commit 7b859f9 into gorsuch:master Jan 2, 2017
@sokkojohnny1 sokkojohnny1 deleted the fix-cached-connection-nil-check branch January 2, 2017 17:20
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

Successfully merging this pull request may close these issues.

Decreased throughput
2 participants