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

Drogon 2.0 #682

Open
rbugajewski opened this issue Jan 11, 2021 · 25 comments
Open

Drogon 2.0 #682

rbugajewski opened this issue Jan 11, 2021 · 25 comments
Labels
enhancement New feature or request

Comments

@rbugajewski
Copy link
Collaborator

This is the place for general discussion regarding the development of Drogon 2.0. The upcoming version will introduce breaking changes, but there’s also the opportunity to improve on existing APIs.

Until development of version 2.0 reaches a more mature state, all feature requests and discussions should be part of this issue.

@rbugajewski rbugajewski added the enhancement New feature or request label Jan 11, 2021
@marty1885
Copy link
Member

marty1885 commented Jan 12, 2021

Just want to share some frustrations I have.

  • Please switch to a faster JSON library (nlohmann/json, rapidJSON, etc..) JsonCpp in kinda slow. I often wrap around Drogon's methods for performance.
    • nlohmann/json is 4x faster and rapidJSON is 40x
    • Both tries to be type safe. But raiidjson doesn't do graceful handling
  • Use string or string_view for content type. And allow user defined ones. Submitting a PR just to add a new file is unnecessary.
  • Exceptions can escape the event loop (Framework-wide C++ exception handler #600) then crash the entire app. And we might have to deal with exceptions when introducing coroutines anyway.

And my wish-list:

  • C++ modules support
  • Switch to Botan to make cryptography easier
  • Switch to a response object instead of using callbacks. This should make HTTP/2 easier to implement. And more intuitive

I'm looking into getting HTTP/2 and coroutines support. But not sure if I can make it happen (coro shouldn't be an issue). I'll try to contribute as much as I can.

Thanks.

@sardar01
Copy link

sardar01 commented Jan 13, 2021

nlohmann/json definately. Query- cannot brotli complelely replace zlib?

@marty1885
Copy link
Member

@sardar01 Brotli doesn't work under all conditions. Ex: most browsers won't accept brotli over plan HTTP. And gz is good fallback for old browsers.

@seiichi-yoshimune
Copy link

On a side note according to 'caniuse' :
brotli has as this writing 94.34% of Global coverage.
tls1.2 has as this writing 98.24% of Global coverage.
tls1.3 has as this writing 90.98% of Global coverage.

ideally you'd want to serve modern client with static brotli with a tls1.3 0RTT resumable session, and as fallback for older clients use static/dynamic gzip with at minimum tls1.2

but this depends mostly on your desired level of security / performace and if for you that small % of old clients is your main target audience or your so big that even a small percentage means loads of clients...

@ivanka2012
Copy link
Contributor

ivanka2012 commented Jan 21, 2021

A good testing framework and suite would be great. If you want to catch the big fish, you might as well advertise it as safe and reliable too.
About @marty1885's answer

Switch to Botan to make cryptography easier

Why not use Crypto++? It's a much more popular choice when it comes to C++ crypto

@mkrupcale
Copy link

I don't know exactly what drogon needs in a JSON library, but if switching default JSON libraries and performance is a primary concern, simdjson[1] is probably the best.

Another interesting thing to explore performance wise is using io_uring rather than epoll on Linux[2-4].

As far as crypto libraries go, I don't really see much reason to switch from OpenSSL. It is likely one of the most tested and proven crypto libraries in the world, and I'm not sure the drogon user needs to be concerned with the crypto API anyways (it looks to be used only in trantor/trantor/net/inner/TcpConnectionImpl.cc as an implementation detail). So you might as well pick the fastest and most secure/tested crypto library.

[1] https://github.com/simdjson/simdjson
[2] https://unixism.net/2020/04/io-uring-by-example-part-3-a-web-server-with-io-uring/
[3] https://ndportmann.com/io_uring-preview-release/
[4] https://github.com/frevib/io_uring-echo-server/blob/io-uring-feat-fast-poll/benchmarks/benchmarks.md

@danwt
Copy link

danwt commented Feb 1, 2021

Another interesting thing to explore performance wise is using io_uring rather than epoll on Linux[2-4].

Would a change to uring be made in Trantor rather than Drogon?

@mkrupcale
Copy link

Would a change to uring be made in Trantor rather than Drogon?

Yes, I believe so, although I don't know all the technical details of the relationship between them to say it's exclusively a change in trantor.

@rbugajewski
Copy link
Collaborator Author

We should also discuss about API changes before the first public release of the next major version, because we will be able to introduce API-breaking changes. I created a placeholder ticket for now.

@rajhlinux
Copy link

rajhlinux commented Apr 21, 2021

Add real security, I have plans to use dragon for it's speed for a start up company but it doesn't have good security.

Would be nice if "Baton" can be added since it is the best Cipher Suite library in C++ and Dragon will benefit from this.
This will be perfect for the Dragon project and almost any enterprise can use it if they are determined enough.

Thanks.

@rbugajewski
Copy link
Collaborator Author

We won’t add our own security implementation as we don’t have the possibility of audits, but better integration of a third-party dependency is a good idea, thanks.

@rajhlinux
Copy link

We won’t add our own security implementation as we don’t have the possibility of audits, but better integration of a third-party dependency is a good idea, thanks.

That is what I really intended to say, you are right that it doesn't make sense to actually implement security from scratch.

Dragon is really interesting, I see it's future as an enterprise ready web server. It's benchmarks is always on the top.

@justghostof
Copy link
Contributor

justghostof commented Jun 7, 2021

请问是否可以在app().run();时就创建controller对象而不是在收到第一个请求时,这样方便将初始化代码直接放在控制器类的构造函数中

@an-tao
Copy link
Member

an-tao commented Jun 8, 2021

请问是否可以在app().run();时就创建controller对象而不是在收到第一个请求时,这样方便将初始化代码直接放在控制器类的构造函数中

@mwx2006 , the PR #888 is for this requirement, please check it. thanks.
@marty1885 should we add a option to enable this feature? or just create all controllers in beginning?

@marty1885
Copy link
Member

For others, translation: Could we have very controller spawn upon app.run()instead upon first request.

Are there down sides of eagerly creating controllers instead of lazily? If you can, add a test to make sure controllers won't get added automatically if auto registering is disabled.

@rbugajewski
Copy link
Collaborator Author

I’m for creating all controllers in the beginning, and adding a lazy controllers option to get back the previous behavior if desired.

@rbugajewski
Copy link
Collaborator Author

Are there down sides of eagerly creating controllers instead of lazily?

  1. Startup times are longer
  2. Memory footprint is slightly larger

I can’t think of any other downsides, and I think these are perfectly fine compromises for server-side applications.

@omar-mohamed-khallaf
Copy link
Contributor

Should hiredis be replaced with redis-plus-plus?

@kassane
Copy link

kassane commented Jun 6, 2023

@an-tao , Drogon v2 will add asio's support only the boost libraries version or also support the standalone version?

@an-tao
Copy link
Member

an-tao commented Jun 6, 2023

@an-tao , Drogon v2 will add asio's support only the boost libraries version or also support the standalone version?

It uses the standalone version as the networking library.

@papel
Copy link

papel commented Feb 22, 2024

I think it should escape HTML from parameters (#1793).

@AmdRyZen
Copy link

2.0 名字也建议换成 2024 官方的 Loong drogon 之前的翻译有问题 类似于会飞的蜥蜴

@an-tao
Copy link
Member

an-tao commented Mar 23, 2024

2.0 名字也建议换成 2024 官方的 Loong drogon 之前的翻译有问题 类似于会飞的蜥蜴

谢谢你的建议,不过Drogon是角色名字不是物种名字(dragon),请参考readme的说明。

@rafapcarvalho
Copy link

rafapcarvalho commented Apr 26, 2024

Please add support to HTTP/2 (server and client), for 5G development it's necessary.

@marty1885
Copy link
Member

@rafapcarvalho HTTP/2 client is in progress. I am just busy to push it forward it right now

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

No branches or pull requests