13 ms·
Iris: Fast back-end web framework for Go
- deleted 10y ago[deleted]
- mappu 10y agoThe performance comes from using https://github.com/valyala/fasthttp https://github.com/valyala/fasthttp instead of the stdlib net/http. From this project's FAQ: >Why creating yet another http package instead of optimizing net/http? Because net/http API limits many optimization opportunities.
- Bombthecat 10y agoAnd then you got your database and you speed is comparable to the rest of the world :) What I think could work is a pure in memory database with server combination. Something like redis for websites.
- Svenskunganka 10y agoI use Redis as the primary and only database. This results in quite large savings in terms of server infrastructure since memory has never been cheaper than it is today and the minimal amount of resources Redis consume in relation to the massive amount of throughput it provides. Additionally, it has data persistence reliability on par with Postgres and other battle-tested databases[0], so couldn't be happier about that. The selling point of Redis for me has been its simplicity. It has a fairly small set of features in comparison to other databases, yet extremely powerful. [0] - http://oldblog.antirez.com/post/redis-persistence-demystified.html http://oldblog.antirez.com/post/redis-persistence-demystifie...
- deleted 10y ago[deleted]
- qaq 10y ago"it has data persistence reliability on par with Postgres" if we pretend transactions do not exist and postgres is running in some non-default config then maybe, but we don't need to pretend.
- calcifer 10y agoRedis has transactions as well.
- qaq 10y agoyes and if you set appendonly yes appendfsync always you will get about +/- PG write performance without all the features Now I know 0 production projects using these Redis settings and I would argue it's not intended use of Redis same way as running PG with fsync = off is not generally what you want to use
- mbrock 10y agoWhy isn't it intended use? And are there actual problems with it even if it isn't intended use?
- jpgvm 10y agoIt's not intended use because fsyncing every write to disk makes it inferior to every datastore designed to fsync every write. See here PostgreSQL. For read performance if your dataset fits in memory PG is just as fast as Redis. The main attraction of Redis is in-memory writes with async persistence. Trading durability and availability for the increased performance. If you give up this then there is precisely 0 reasons to choose Redis over PostgreSQL.
- anarazel 10y ago> The main attraction of Redis is in-memory writes with async persistence. FWIW, you can have that in postgres as well, cf. synchronous_commit = off > Trading durability and availability for the increased performance. If you give up this then there is precisely 0 reasons to choose Redis over PostgreSQL. As a PostgreSQL developer, I'd say that performance / latency / jitter can still be reasons to choose redis over postgres. The per-read overhead in redis is often a good bit lower than in postgres, and there's less variability in response times.
- fweespeech 10y agohttps://muut.com/blog/news/april-2014-service-failure.html https://muut.com/blog/news/april-2014-service-failure.html https://muut.com/blog/technology/redis-as-primary-datastore-wtf.html https://muut.com/blog/technology/redis-as-primary-datastore-... Counter point of a real world implementation where they tried to make it the primary data store.
- Svenskunganka 10y agoHave you even read the article? This was caused by Mongo running with a wrong flag, and the authors explicitly said that their backup script only contained ONE backup. That's bad engineering, not fault with Redis. Redis is extremely safe if you configure it correctly.
- fweespeech 10y agoYes, on a small number of nodes it works in a handful of use cases. That isn't the same as it being equal and equivalent in terms of reliability at scale. They resorted to weird hack-y shit for something I use MySQL or Postgres for on a regular basis. So have most people who built stuff on Redis like this: > I use Redis as the primary and only database. > Additionally, it has data persistence reliability on par with Postgres and other battle-tested databases[0], so couldn't be happier about that.
- mtanski 10y agoredis by default does not fsync every change, instead it syncs every second. So no it's data reliability is not on par with Postgres in the default configuration.
- oceanic 10y agoMemSQL (http://www.memsql.com/community/ http://www.memsql.com/community/) might also be an interesting option to try.
- Bombthecat 10y agoWow, that looks cool. Will look into it after work :) Thanks
- brightball 10y agoLike ETS/DETS for Elixir/Erlang?
- benbjohnson 10y agoI've been using a local key/value store as my backing database and it works great. Primary key access is usually less than 1µs and net/http is typically my bottleneck. That being said, unless you're getting a massive number of requests, using a specialized HTTP library seems like overkill.
- kasey_junk 10y agoWhat do you mean by usually? What do the "bad" cases look like and how often do they happen? How are you measuring that key access and is it happening across cores? Are you setting any OS level settings around isolation?
- vardump 10y agoThe world is not only about CRUD apps with a database backend.
- fishnchips 10y agoA surprisingly large part of the world is about CRUD apps. And among the non-CRUD apps a surprisingly large part of them is still CRUD.
- valyala 10y agoThere are a plenty of in-process 'databases' for Go starting from a simple built-in map and ending with something like https://github.com/boltdb/bolt https://github.com/boltdb/bolt or even https://github.com/hashicorp/go-memdb https://github.com/hashicorp/go-memdb .
- gummiruessel 10y agoIt's worth noting that fasthttp doesn't support HTTP/2.0. According to the README, there are plans for it in the future.
- amelius 10y agoHmm, thus not so fast after all ...
- onion2k 10y agoThe graph on the homepage says echo2-fasthttp processed almost half the requests that iris processed, but in half the time. Wouldn't that make them approximately equal? I think what it's trying to communicate is the number of requests each framework managed in 500ms, but it isn't clear.
- Dzugaru 10y agoWouldn't trust programmers, who make illogical graphs like that one :D
- xaduha 10y agoI wouldn't trust any web framework that isn't yet on https://www.techempower.com/benchmarks https://www.techempower.com/benchmarks It might not be perfect, but it's common ground.
- weberc2 10y agoCool site. FWIW, fasthttp powers iris, and it's in these benchmarks (and doing very well at that!).
- rattray 10y agoFeatures: https://kataras.gitbooks.io/iris/content/features.html https://kataras.gitbooks.io/iris/content/features.html (seems to be missing a data/SQL/ORM layer) Usage docs for rest api: https://kataras.gitbooks.io/iris/content/render_rest.html#usage https://kataras.gitbooks.io/iris/content/render_rest.html#us...
- piotrkubisa 10y agoNot including an ORM layer does not decrease "value" of this framework, because you can attach such lib on your own. In Go the you are very flexible to set up a "a place where data will be stored/queried" - there is fabulous database/sql (or additional layers like lib/pq [1]) which is great for many use cases; also orm-like solutions like gocraft/dbr [2]; oh, I also should mention Gorm [3] or Bolt [4]. Setting them up is really easy in any Go web frameworks because (almost) all database modules rely on abstraction from stdlib. [1] https://github.com/lib/pq https://github.com/lib/pq [2] https://github.com/gocraft/dbr https://github.com/gocraft/dbr [3] https://github.com/jinzhu/gorm https://github.com/jinzhu/gorm [4] https://github.com/boltdb/bolt https://github.com/boltdb/bolt
- rattray 10y agoThat's true; the same could be said for many other parts of the stack, including several features that were included, like TypeScript compilation. Given that interacting with a database is at least as common a webdev task as, say, i18n, I thought it was worth noting that this framework does not have a db solution of choice.
- ptman 10y agoIsn't lib/pq more like a driver that's used through database/sql than an additional layer ?
- piotrkubisa 10y agoIndeed. Thank you for pointing this out.
- 10y ago
- OriginalPenguin 10y ago"It’s gonna work good on all devices." Don't they mean work well?
- lucasp82 10y agoThe project creator is not a native English speaker. Let it go.
- oneloop 10y agoWhy do you take the time to make empty comments? Think about that. Anyway, it's acceptable American English. Comments empty and wrong.
- omginternets 10y agoIf I were a non-native speaker, I'd be happy to have feedback on my English. Just sayin'
- gelatocar 10y agoThat graph is really confusing, is the x axis a progression of processing times from 0 up to ~1000ms? If so then wouldn't it mean that Echo-2-fasthttp has nearly as good requests/second?
- mkishi 10y agoIt is confusing. They meant the benchmark used a 500ms "workload" (sleep) per request handler -- x isn't really an axis.
- Svenskunganka 10y agoThe graph at their GitHub page might be a bit easier to understand: https://github.com/kataras/iris https://github.com/kataras/iris There's a bit more detailed bench here: https://github.com/smallnest/go-web-framework-benchmark https://github.com/smallnest/go-web-framework-benchmark
- deleted 10y ago[deleted]
- kataras 10y agoI dont want to interrupt you guys, just writing this info. I will not try to do criticism on other comments, you're free to tell everything about the project, but I think you should read the README first and navigate to the benchmark suite (which is not mine) https://github.com/smallnest/go-web-framework-benchmark https://github.com/smallnest/go-web-framework-benchmark . He explains why this is the most realistic benchmark suite so far. Thanks you for using (or talking about) Iris!
- stirner 10y agoNot only is this page riddled with typos that lead me to doubt the quality of the code, the concept of a framework is fundamentally complex and at odds with the goals of Go.
- lucasp82 10y agoThe project creator is from Greece and is not a native English speaker. How about maybe cut some slack.
- stcredzero 10y agoSure, so long as he's open to incorporating corrections.
- zongitsrinzler 10y agoBecause being a native english speaker has a lot to do with the quality of code, how rude..
- tumdum_ 10y agoTypos are easily checked by dictionary - no need to be native speaker for that :)
- Etheryte 10y agoChecking for typos using a dictionary makes little sense. Let's take the example that was pointed out in another comment: "It’s gonna work good on all devices." According to a dictionary (Oxford American, but use which ever you prefer), good can for example stand for "having the required qualities, of a high standard", which can easily sound fitting when you're not a native speaker.
- stirner 10y agoEnglish is a language with grammar that has a Stack Exchange site and can be Googled. The typos on the page are common for native English speakers who don't take the time or effort to check their writing for correctness. The author did not grow up from babyhood writing Go programs, but we expect them to be correct and adhere to known idioms.
- StreamBright 10y agoAny time I see a chart about web server performance without displaying the corresponding error rate and latency numbers I start to think that the author does not understand the performance aspect of HTTP services entirely.
- ricardobeat 10y agoError rate? I believe when doing http benchmarks it is assumed to be zero.
- oneloop 10y agoCould someone clarify: why is Go faster than say Python? And if the answer is just that it's a lower level language and therefore has less overhead, why not just use C?
- insertnickname 10y agoGo actually lets you work at a quite high level, much like C# or Java (and the performance is in the same ballpark). I think a better question to ask is: why is Python so slow?
- oneloop 10y agoOk, so why is Python so slow (comparatively)? I had understood that must of the speed-critical tasks in python were done by wrappers of lower-level C code. Example: numpy. Is this not correct?
- TheHydroImpulse 10y agoThe reason it's slow is because python interprets it's input. It essentially introduces major indirection for instructions to be executed. So for '1 + 1', you can't just output some fast x86 instruction and inline it. You'll usually need to jump to where the python vm will do 'a + b' in C. You're having to do a bunch of redundant work at a higher level to emulate the CPU (sorta). That's why you have JIT compilers that will read '1 + 1' and compile the appropriate machine code, store that in an executable memory region and jump to it. First time might be slow, but after that it's pretty fast. Because you need to jump to the dynamically generated code, you usually compile whole functions at a time. This topic is super complicated but also super interested but I tried to simplify it a bit here.
- insertnickname 10y agoYou can indeed do that, and there are other ways to speed up Python (PyPy, Cython, or even just writing more efficient Python code). However, the problem is that you now have to write C. A lot of the slowness in Python probably comes from the many memory allocations all over the place. Go gives you a lot of control over allocations even though it is a garbage collected language. These slides posted by another commenter has some good points about why Python is so slow: https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow https://speakerdeck.com/alex/why-python-ruby-and-javascript-... Interestingly, there was actually a talk at PyCon US 2016 about using Go's http server in Python via C. https://www.youtube.com/watch?v=CkDwb5koRTc https://www.youtube.com/watch?v=CkDwb5koRTc
- znpy 10y agoThere was a discussion about Iris on the github issue tracker of Gin, another framework, dated March 13 2016: https://github.com/gin-gonic/gin/issues/560 Some benchmark were made too.
- benguild 10y agoThanks for posting. I was wondering how this compared to Gin.
- anilyeni 10y agonice site to know the other frameworks.
- tapirl 10y agowhy (and how) comparing web frameworks to httprouter, it is just a router.
- carlosdp 10y agoThat's the wrong type of graph for that data... should clearly be a line graph.
- yeonsh 10y agoDiscussed on reddit before and I found that Iris uses caches to speed up. https://www.reddit.com/r/golang/comments/4a8yit/is_this_the_fastest_go_web_framework/ https://www.reddit.com/r/golang/comments/4a8yit/is_this_the_...