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

Async #25

Closed
GuacheSuede opened this issue Feb 26, 2017 · 11 comments
Closed

Async #25

GuacheSuede opened this issue Feb 26, 2017 · 11 comments

Comments

@GuacheSuede
Copy link

GuacheSuede commented Feb 26, 2017

Hi Thomas, is there async/multithreading support ?

@daedric
Copy link
Owner

daedric commented Feb 26, 2017

Hi,
The server and client are already async and support multithreading.
Can you elaborate on what you need ? :)

@GuacheSuede
Copy link
Author

@daedric Hi Thomas, I am trying to write an API server serving JSON. What do you suggest ?

@daedric
Copy link
Owner

daedric commented Feb 26, 2017

Several API endpoint have been implemented using HTTPP already.
The server will handle the request for you and call the function you defined. You can take a look at some of the examples:

The connection you get in the callback can be kept as long as you decide. HTTPP does not put any constraints on when you have to answer.
For instance this library is used in some RTB project where we keep the connection for about 200msec waiting for an answer or we send back a 204.

Do not hesitate if you have more questions :)

@GuacheSuede
Copy link
Author

GuacheSuede commented Feb 26, 2017

Thank you Thomas, great help, got it now :)

@GuacheSuede
Copy link
Author

@daedric Thomas, dont mind me asking where do you use this in your work and what for ?

@daedric
Copy link
Owner

daedric commented Feb 26, 2017

Not at all,
So as previously said it is used as a RTB gateway. It receives a decent amount of traffic that gets normalized and sent to a backend that will compute an answer. If the answer does not come before the timeout, a standard answer is sent (204).
It is also used as internal REST service with low traffic. In this case C++ is overkill but in the project using HTTPP the code was able to reuse some existing C++ code avoiding a code duplication.
And more recently it is used at my previous job as a gateway once again, very similar to the RTB use case but without the need to wait for an answer from the backend.
It is production ready and proven very stable and efficient. Compared to some of the alternatives (which were not existing at the time the first version was written) it is also much smaller.

It is worth mentioning that HTTPP is to be behind a nginx or some other full featured and more secure server or only open to some trusted network.

@GuacheSuede
Copy link
Author

Thanks for the reply Thomas, would you happen to have an example for the nginx proxy to server ? Also have you considered plugging an lwan backend ?

@daedric
Copy link
Owner

daedric commented Feb 26, 2017

About nginx look up upstream block and the proxy_pass statement.
About lwan yes, it was a strong possibility but it had and has too many features we did not need (mime, files, compression, etc.) and more; therefor, HTTPP core is about half of lwan's.
It was also not advertised as something stable in 2013.

Long story short, HTTPP aims as being as simple as possible, if you want to serve files this is certainly not the library to use.

@GuacheSuede
Copy link
Author

Great !, Thank You Thomas for the nginx refrence.

@GuacheSuede
Copy link
Author

@daedric Good News Thomas, I have decided to use this Library !

@daedric
Copy link
Owner

daedric commented Feb 26, 2017

I'm really glad to ear it.
Do not hesitate to create issues if you need help with anything

cheers

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