6 ms·
Gearbox – A web framework written in Go
- abahmed 6y agogearbox is a web framework written in Go with a focus on high performance and memory optimization
- PhilippGille 6y agoWith the performance coming from being based on fasthttp, what does the framework offer on top? The README doesn't really mention any features explicitly (other than soft ones like "secure" and "fast"). A comparison with other fasthttp-based frameworks like https://github.com/savsgio/atreugo https://github.com/savsgio/atreugo or https://github.com/gofiber/fiber https://github.com/gofiber/fiber would also be interesting. Or maybe a benchmark along the lines of https://github.com/smallnest/go-web-framework-benchmark https://github.com/smallnest/go-web-framework-benchmark. Looking at the commit history (7 commits, most of them from yesterday), the open issues (no way to define URL path variables yet, https://github.com/abahmed/gearbox/issues/15 https://github.com/abahmed/gearbox/issues/15), and the release being v0.0.1, maybe it's a bit too early for a ShowHN? But if you have a vision of how it will be different and better than existing frameworks and the willingness to keep working on your project, then honestly good luck with it, it might become interesting in the future!
- abahmed 6y agoYes. You are right about that, but we think a bit differently. we think that would be a good chance for contributors that want to contribute to Go projects or frameworks, also tell that we are trying to build something better and surely we have a vision. For the benchmark, we already opened a PR (https://github.com/smallnest/go-web-framework-benchmark/pull/75 https://github.com/smallnest/go-web-framework-benchmark/pull...) after running it locally. Thanks For your feedback
- tcbasche 6y ago"We haven't really done anything useful, but please someone come and make it better" This is why we have so much crap on GitHub. OP has admitted this solves no real-world problems, and I would argue there is nothing wrong with net/http that it would require anyone to bother installing this stuff.
- abahmed 6y agoDon't agree with you. We -gearbox community- are working on improving and adding more functionalities, not waiting as you said. Also, we welcome anyone wants to contribute and help us to make gearbox better. what meant by "solves no real-world problems" was that there are solutions (each one has its benchmarks) and what we are doing is trying to provide it with a better performance
- tcbasche 6y agoBut why market it as "gearbox is a web framework for building micro services written in Go". If it's not production-ready, who are these micro services for? It just seems not even close to polished enough to share it with the wider community. Someone may take this at face-value and try and use it for their own purposes, only to discover it's a purely academic pursuit with no actual merits other than 'oh we might be able to spuriously improve performance.' I think other commenters have got it right in saying that processing requests is _not_ the bottleneck of most micro services, but interaction with a storage layer or network speed.
- abahmed 6y agoRecently, we have mentioned that gearbox is still under development and not ready for production usage till we finish supporting all basic functionalities and have a benchmarks results (also for the current release). Thanks for your feedback
- eerrt 6y agoDid you run any benchmarks against other frameworks such as https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png https://github.com/gofiber/docs/blob/master/.gitbook/assets/... or https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png https://github.com/gofiber/docs/blob/master/.gitbook/assets/... ?
- abahmed 6y agoYes, and there is already an opened Pull Request to https://github.com/smallnest/go-web-framework-benchmark/pull/75 https://github.com/smallnest/go-web-framework-benchmark/pull...
- cfors 6y agoSo this provides an http router written on top of fasthttp? Why would this be better to use than something like Gin, which has way more features? I would update the docs to be clear about that. What is the advantage of your custom router implementation over others? Neat project, but it’s hard (at the moment) to see why this would be useful over some of the more mature go web frameworks. Edit: obviously performance is important, but how much faster is it than gin for example if I am going to be giving up features for speed.
- lopatin 6y agoI think you're missing the point of the project, which is for the author to have lots of stars on his GitHub profile.
- o-__-o 6y agoDon’t hate the player, hate the game
- skrebbel 6y agoWhat did the author do to deserve this comment?
- lopatin 6y agoBy releasing what is borderline vaporware. Or perhaps a better word would be a noob-trap. The meat of the project is a router around fasthttp, which presumably is fast because it uses a ternary search tree. Which I fail to see the performance benefits of in this situation, but the point is that even this isn't explained. I don't want to be too harsh, or discourage innovation, but I do believe there is a net-negative effect on the community when simple projects that could have been Gists are marketed as something they're not. I saw this 100x in the Node.js ecosystem and admire Go because it is kind of the antithesis of that.
- abahmed 6y agoI don't agree with you. It does not mean anything if the project has lots of stars and it's not used or useful. gearbox is a trial to achieve better performance than current frameworks.
- PZ81JUXJE7uJ 6y agoWhy not import all those consts from net/http?
- quicklime 6y agoAt least with Go 1.14 (what I got with Ubuntu 20.04) importing net/http could add another 4.7MB to the binary size. This might've been fixed in Go 1.15 though - see https://twitter.com/bradfitz/status/1256348714198654976 https://twitter.com/bradfitz/status/1256348714198654976.
- rcarmo 6y agoNot bad. I just clocked this doing 300Krps (on localhost, on an old i7).
- abahmed 6y agoThanks!
- AbuAssar 6y agoVery promising! Keep up the good work
- abahmed 6y agoThanks!
- d1str0 6y agoNot a fan of unsafe pointers in Go frameworks. :/
- zemo 6y agobeen writing Go since 2011, have written many http servers, have never really worried about net/http performance. the bottleneck is usually the storage layer. let's say you have no storage, your bottleneck is probably serialization. let's say you don't have serialization problems (except for net/http, optimizing which you could argue is a deserialization problem), what is the problem-domain that's being tackled where you have cpu-bound http performance problems where you shouldn't just use udp instead? let's say you have no storage or serialization problems, you have a lot of http traffic. if the whole thing is stateless, you add nodes behind a load balancer and call it a day. ok, none of those things apply: you're dealing with a CPU-bound, stateful http server with all of its state in memory, and it's not fast enough. you are, presumably, at scale and have customers or users; if you weren't at scale, you probably wouldn't be facing this sort of performance problem. so you use something like fasthttp to help you ... scale one node to a very large size? um, I guess you could do that, but now you have a lot of traffic and you've scaled a single point of failure. I just don't get it. I don't get what actual real-world problem this solves that isn't imaginary.
- deleted 6y ago[deleted]
- abahmed 6y agoI totally agree with you and we all know that (I have a good background and experience from my work in docker and kubernetes), but what we are trying is not to solve real-world problem, we are trying to optimize and enhance using different ways / algorithms to build something better and surely we have a vision. Thanks for your feedback
- aloknnikhil 6y agoCode comments like these frustrate me > // constructRoutingTree constructs routing tree according to provided routes > // gearbox implements Gearbox interface > // New creates a new instance of gearbox It's obvious from the names of the functions WHAT they do. The point of the comments are to tell me WHY they are necessary. The project feels like commenting for the sake of commenting. I honestly don't know why a "routing tree" is necessary and how it's helping.
- BossingAround 6y ago> > // gearbox implements Gearbox interface The problem I have with Go is that it does not show an object implements any interface. The implementation is implicit, i.e. you implement the method signatures, and you implement the interface. That particular comment is actually quite useful.
- onionisafruit 6y agoThe java equivalent is GearBox interface with a GearBoxImpl implementation. I wrote that more times than I like.
- abahmed 6y agoWe wanted to make everything clear. We do routing using Radix tree (https://en.wikipedia.org/wiki/Radix_tree https://en.wikipedia.org/wiki/Radix_tree) and we call it routing tree. BTW, more documentation are on way to be added
- Antoninus 6y agoComments above Exported functions are to appease one of the stock linters. A quick search or a experience writing Go should help you with this.
- ryanar 6y agoThis is because golint complains if you do not write a comment above an exported function. While it does indeed seem silly when reading the code, the purpose is for the go documentation that is automatically generated from this. See https://golang.org/pkg/net/http/#NewRequest https://golang.org/pkg/net/http/#NewRequest for an example of this in action where the comment is essentially worthless, and this comes from the go std library. Go's stance is that it is better to always have people document exports, even if some are trivial and duplicates, it is better to always enforce it so that comments are there for the exports that do benefit from a "why". If you really hate the comments, in your own projects you can use Revive which is a drop-in replacement for golint and allows you to disable lint rules like comment annotations. https://revive.run/ https://revive.run/
- ai_zahran 6y agoThis project seems promising. Good effort, I am really interested in seeing where this is going.
- abahmed 6y agoThanks!