On Wed, Feb 17, 2016 at 02:32:54PM +0000, Sergey Lyubka wrote:
> Thanks for sending that comparison, it's quite helpful.
> As original author of Mongoose server, I'd like to make a couple of points:
Thank you!
> 1. Binary size. There is a lot of functionality enabled in Mongoose by
> default, which can be trimmed down with compilation flags. For example,
> this compilation line trims mongoose binary to about 70k (run in cloned
> mongoose repo), on x86_64 MacOS:
>
> *make -C mongoose/examples/simplest_web_server clean all CFLAGS_EXTRA="-Os
> -DMG_DISABLE_MQTT -DMG_DISABLE_JSON_RPC -DMG_DISABLE_HTTP_DIGEST_AUTH
> -DMG_DISABLE_CGI -DMG_DISABLE_DAV -DMG_DISABLE_DNS -DMG_DISABLE_HEXDUMP
> -DMG_DISABLE_SSI -DMG_DISABLE_RESOLVER" && **strip
> mongoose/examples/simplest_web_server/simplest_web_server && ls -l
> mongoose/examples/simplest_web_server/*
>
> *-rwxr-xr-x 1 lsm staff 68052 Feb 17 14:21 simplest_web_server*
That's nice. FWIW, my ~100 KB figure for libonion was based on running
size(1) on the .so file. I've since tried linking the examples/jsonrpc
program (including JSON-RPC) against the .a file, and for that I also
got 68 KB for "text". The binary size is slightly larger than 70 KB,
but overall it appears the different libraries here are of similar size,
probably except for libevhtp.
> 2. Mongoose on Linux is single threaded, can use epoll for IO multiplexing.
I was probably wrong in including it in the comparison, then. There are
several other single-threaded embeddable HTTP server libraries.
> 3. Mongoose is not just a web server. It's a swiss army knife, currently
> having support for *HTTP, Websocket, MQTT, CoAP, DNS, JSON-RPC, plain TCP,
> plain UDP protocols*. Also, for each protocol, it implements *both client
> and server functionality*.
Yes, I noticed you had another project called Fossa, which you've since
merged into Mongoose. I didn't realize it included client functionality.
> 4. "mongoose almost achieves this, but at the expense of sacrificing
> meaningful separation into multiple translation units within the library
> itself" - Internally, our development repo has multiple files (just like
> SQLite), but we amalgamate sources for the production use. This makes
> embedding easy, which is our ultimate goal.
OK. I understand there's a tradeoff involved.
> Mongoose license is GPLv2/commercial, cause we have a company that backs up
> support & development, and it's trusted by small and big businesses, our
> clients include NASA, Intel, Qualcomm, Samsung, HP, and many more.
> </marketing>.
Cool!
> > On a related note, David's use of Coverity for libonion is commendable,
> > but it looks abandoned since 2014, and many "defects" (even if false
> > positives) remained unfixed back then.
> >
> > Mark's use of Coverity for libevhtp is also commendable... and looks
> > abandoned since May 10, 2015. It shows "48,919 Lines of Code Analyzed",
> > only "4 Total defects" and "0 Outstanding" - I guess it means that
> > everything detected by Coverity before (which must have been many more
> > "defects") had been eliminated prior to that run. That's impressive.
> > But we don't know how many new "defects" may have appeared in the 9
> > months that passed. Also, I haven't looked into whether libevent has
> > been subjected to similar static analysis or not (although being
> > initially written by Niels Provos speaks in its favor, given Niels'
> > other work), and accepting TCP connections isn't as much risk as parsing
> > HTTP and JSON.
I've since realized that all four (or a fork in case of Mongoose) have
been subjected to Coverity, and in fact libmicrohttpd scores best -
last checked in 2016, with zero outstanding "defects".
https://scan.coverity.com/projects/5084 libevhtp
https://scan.coverity.com/projects/1815 onion
https://scan.coverity.com/projects/gnu-libmicrohttpd
https://scan.coverity.com/projects/kazan417-mongoose
> > I don't give a lot of weight to the Coverity results for my
> > decision-making, but it shows whether the maintainers care, and there
> > are few other somewhat-meaningful metrics I could use before having
> > spent time to analyze and try to use the code myself.
Alexander