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

You can also write to nsq using http. What are the advantages of go-nsq over the http method #289

Closed
guonaihong opened this issue Mar 17, 2020 · 2 comments
Labels

Comments

@guonaihong
Copy link

As the title

@guonaihong
Copy link
Author

Whether there is pressure test data?

@ploxiln
Copy link
Member

ploxiln commented Mar 17, 2020

Using http is convenient, you can use the http request library of any language or framework you want. In many cases it may be quite sufficient for the use case / message rate.

The "binary" protocol is more efficient in terms of both bytes and cpu-time. All the http headers are skipped. The binary protocol message publish is like:

PUB <topic-name>\n
<4-bytes-len><N-bytes-body>

and the response is like:

<4-bytes-len><4-bytes-type>OK

That is a lot less work to parse than HTTP headers.

Unfortunately I don't have a good benchmark comparing performance of each method directly ... we have a few benchmarks in our nsqd test suite, but not that in particular, I don't think ...

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

No branches or pull requests

3 participants