M
Modular4mo ago
a2svior

SSL/TLS Support?

Is there anything planned for Mojo stdlib in terms of SSL/TLS? I'm thinking something like Golang's crypto/tls or Python's SSL socket wrapper We want to add HTTPS support to Lightbug but for that would be good to know if the stdlib will include this functionality any time soon or if this has to be built by the community
Python documentation
ssl — TLS/SSL wrapper for socket objects
Source code: Lib/ssl.py This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both clien...
GitHub
HTTPS Support · Issue #20 · saviorand/lightbug_http
Is your feature request related to a problem? Please describe. Would be nice to be able to say that a website I made with this is "secure" (the s in HTTPS) Describe the solution you'd...
28 Replies
GnU So Cute
GnU So Cute4mo ago
I think they won't intend to do it now, they still optimize core
Darkmatter
Darkmatter4mo ago
I think getting basic networking in std first makes more sense. I’d ideally like an API that supports ktls since that can use hardware accelerators (many Intel Sapphire Rapids systems, all AMD EPYC processors, Cavium’s ARM servers (still popular), Mellanox NICs, etc).
GnU So Cute
GnU So Cute4mo ago
what is ktls?😭
GnU So Cute
GnU So Cute4mo ago
you really know how system working bro 😭
Darkmatter
Darkmatter4mo ago
It’s quite literally my job to know about this kind of thing.
GnU So Cute
GnU So Cute4mo ago
so as you said, we need wait until mojo support that* api to better internet access? as i tested, socket lib from lightbug lib speed slower than python
Darkmatter
Darkmatter4mo ago
I want to go have some discussions with modular people about how networking is going to be done, and although python has an API I think we can offer a one that has the capability to support hardware accelerators much better. At a minimum, I don’t see any reason to not have an io_uring API that’s faked using a thread on other platforms to allow for most programs to have very good networking. Lightbug is a barebones implementation, from what I saw the python http parser has had a lot more work put into it and that’s where most of the performance difference is.
GnU So Cute
GnU So Cute4mo ago
u can join zoom they are streaming
Darkmatter
Darkmatter4mo ago
I have work so no. I can message while waiting on compiles, but that is all.
Jack Clayton
Jack Clayton4mo ago
Hi @a2svior confirmed there are no immediate plans to build those libraries at this stage. Suggestion was to call into C or Python libraries. If you build it in Mojo yourself that would be awesome!
GnU So Cute
GnU So Cute4mo ago
As darkmatter__ mentioned, Mojo is currently focusing on optimizing its core rather than kernel APIs, making the API quite 'expensive' at the moment. Without these optimizations, it's challenging to achieve significant speed improvements. please correct if me wrong
Jack Clayton
Jack Clayton4mo ago
We don't have the engineering hours to invest into the wider ecosystem such as SSL/TLS right now, but would very much appreciate if the community builds it, and we'll be sure to promote it. We're heavily focused on high-performance kernels to enable the MAX engine if that's what you mean?
GnU So Cute
GnU So Cute4mo ago
i mean on network, not max
Jack Clayton
Jack Clayton4mo ago
Right, the priorities are shifting to make calling Mojo libraries from Python and C/C++ a great experience, so that those existing ecosystems including networking can be taken advantage of while we wait for it all to be built in pure Mojo.
GnU So Cute
GnU So Cute4mo ago
yes, thats the only way for now but still waiting for pure mojo
viataram
viataram4mo ago
Do you mean calling Mojo from C or C from Mojo. And I am guessing for Python it's calling Mojo from Python?
Jack Clayton
Jack Clayton4mo ago
Mojo from C, and Mojo from Python yeah
viataram
viataram4mo ago
Sorry, if I continue the discussion. Is there an easy way to do the reverse, call C from Mojo. In that case we can get to use all libraries built in C.
a2svior
a2svior4mo ago
Curious about the performance bit, but we can chat about somewhere else. According to benchmarks that other folks run (you can see in Lightbug's Discord or here we're faster than Python usually Alright, thanks! Sounds good
GnU So Cute
GnU So Cute4mo ago
yes, but as i tested on my local machine, its slower than python like 3-5% better calling c lib from mojo
a2svior
a2svior4mo ago
Can I reach out in DMs ? Would be curious to try and reproduce/see if we can improve the performance for the use case/particular handler you're using
Darkmatter
Darkmatter4mo ago
I'll second calling into C from Mojo. Even if it's very rough "We pass the header through clang until it gets to LLVM IR, then convert it to MLIR and dump it into a file", the community spends a lot of effort transcribing syscalls right now.
Jack Clayton
Jack Clayton4mo ago
yeah using the external call function:
var uid = external_call["getuid", UInt32]()
var uid = external_call["getuid", UInt32]()
Jack Clayton
Jack Clayton4mo ago
GitHub
mojo/stdlib/src/python/_cpython.mojo at nightly · modularml/mojo
The Mojo Programming Language. Contribute to modularml/mojo development by creating an account on GitHub.
Darkmatter
Darkmatter4mo ago
Are there any plans for an equivalent to Rust's bindgen (I'm not expecting Zig's magic interop) in the near future? While external_call works, it's often rather annoying to use and getting anything usable requires transcribing large sets of #defines since we're focusing on talking to libc and adjacent libs right now. If there isn't, I may look into a path through some hacky processing on LLVM IR out of clang.
Jack Clayton
Jack Clayton4mo ago
Importing C/C++ header files and using them directly with Mojo was discussed in the community meeting today as being potentially next year. It is on the roadmap here: https://docs.modular.com/mojo/roadmap#cc-interop
Darkmatter
Darkmatter4mo ago
Thanks, looks like I'll investigate doing something horrible to clang.
Want results from more Discord servers?
Add your server