8 ms·
I have been dabbling in Rust web development lately, coming from a Django/Flask background. I take issue with the article stating: > Can I replace my Rails/Dja
by hugodutka 6y ago
I have been dabbling in Rust web development lately, coming from a Django/Flask background. I take issue with the article stating:
> Can I replace my Rails/Django/Flask already? Yup!
While I agree that you can try to replace Flask with Rust web frameworks, you can't do it for Rails or Django. Rust web frameworks do not let you easily test your application's database access layer nor provide advanced authorization, and lack other features that become necessary when your application becomes bigger.
If you don't need the performance that Rust provides, you should still go for Django or Rails. Otherwise you will end up reinventing them.
- akmittal 6y agoEven if performance matter Go should be a better choice. Go's performance is very close to rust in Web ecosystem and is very mature.
- legulere 6y agoOr C# with ASP.NET Core which is much closer to rust in performance.
- jeswin 6y ago> Or C# with ASP.NET Core which is much closer to rust in performance. I haven't noticed that C# is faster than Go, or that it's as fast as Rust/C++. Except in selected micro-benchmarks, of course. C# is at best in the same bracket as Go: https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=query https://www.techempower.com/benchmarks/#section=data-r19&hw=...
- yread 6y agohttps://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=composite https://www.techempower.com/benchmarks/#section=data-r19&hw=...
- jeswin 6y agoThe fastest .Net based library scores a 58%, while a framework based on Go scores 52%. The weights are arbitrary, so can't infer a lot from the 6% delta between .Net and Go - except that they compare favorably with each other in terms of performance.
- apta 6y agoThe fastest .NET library is ASP.NET Core, which is a standard, mature, off the shelf framework. Compared to the golang version using fasthttp, which is non-standard and makes compromises to achieve speed, and I'd avoid it for production.
- pythonaut_16 6y agoIn my experience ASP.NET and its frameworks are potentially much slower than raw C#. As much as C# is supposed to be a fast language, whenever I run into a C# web app it seems to be inexplicably slow.
- nobleach 6y agoI'm not sure why anyone would be downvoting your data point. I am pretty bothered at how much emphasis folks throw behind the TechEmpower benchmarks. If you really dig into the implementations for the top languages, it's easy to see how far from the real world, those apps are. In the case of C#/ASP.NET, as soon as you add EntityFramework (or Dapper, if that's your thing) and some real-world querying of a database. You're looking at a pretty big slow-down. I'm certain things can be done to speed it up though.
- eznzt 6y agoIs that free in any way?
- pbz 6y agoIt's free in all the ways
- brixon 6y agoC# or ASP.NET Core never costed anything. The cost is in certain versions of Visual Studio, but that is not required. Besides Visual Studio, Visual Studio Code is popular too.
- iruoy 6y agoI can recommend Jetbrains Rider [1] for anything C#. I prefer it over Visual Studio even. [1]: https://www.jetbrains.com/rider/ https://www.jetbrains.com/rider/
- eznzt 6y agoIs it also free to deploy? Can you deploy it on Linux?
- reese_john 6y agoYes. It is also fairly straightforward to dockerize dotnet core apps[0]. [0] https://docs.docker.com/engine/examples/dotnetcore/ https://docs.docker.com/engine/examples/dotnetcore/
- legulere 6y agoThe C# compiler roslyn, the dotnet runtime (Jit compiler, ...), and ASP NET Core are all MIT or Apache licensed and run officially supported on mac os, linux and windows.
- felipellrocha 6y agoThat’s just not true. More mature, sure. But the language experience couldn’t be more different between the two, and that counts. I don’t wanna be wasting my time with quirkiness.
- throwaway894345 6y agoI like Rust and everything, but pretending it’s going to get the job done faster than Go is just that—pretending. If you don’t like Go’s developer experience, then fine (and understandable when the alternative is Rust), but it’s not wasting time IMO.
- deleted 6y ago[deleted]
- ffdjjjffjj 6y agoIt’s not pretending. In fact, web application hosts are a great candidate for replacement with faster languages because it can have an immediate impact on infra costs.
- throwaway894345 6y agoReducing infra costs are rarely the largest opportunity for an organization, and even then the majority of infra waste is typically unrelated to language. Moreover, trading iteration velocity (and/or rewriting your application) for some marginal infra cost improvement is not a very good approach.
- couchand 6y agoWriting a for loop every time you need to iterate over a collection is wasting time.
- aaronblohowiak 6y agoMy ratio of writing to debugging has never been such that the difference between for and forEach ever mattered. That being said, debugging complex go code bases 5 years ago (when I last was doing this daily) was less fun than other languages (their armory stocks a nice assortment of footguns and the debugging support was... minimal. Might have changed since then.)
- joelbluminator 6y agoYou can replace Rails with anything that's Turing complete right? We all know that. C, Assembly, Rust, anything can work. I just don't see WHY. If you're gonna say performance I'm gonna say who cares.
- hugodutka 6y agoJohn Carmack once did [0]. [0] https://news.ycombinator.com/item?id=21907517 https://news.ycombinator.com/item?id=21907517
- pdpi 6y agoPerformance doesn't matter until it does. I've seen a malloc upgrade save millions of dollars.
- amadeuspagel 6y agoOnce you have millions of dollars in hosting costs, you can rewrite your app in rust. Most likely, though, your app is never going to cost more then $5 per month.
- mwcampbell 6y agoAnother way of looking at it though is that by using a more efficient language and framework, you can grow farther on a single server, and that fundamentally simplifies things.
- Isinlor 6y agoYou should grow faster by focusing less on implementation and more on your core business competence. In old school PHP share-nothing architecture you can just throw more servers at it and call it a day until you need to start scaling databases.
- couchand 6y agoBut one misplaced comma and your whole site goes down.
- squeral 6y agoI agree. It will take some time until we have a Rust framework that is as robust and feature-rich as Django or Rails.
- musicmatze 6y agoRails was released 16 years ago (according to wikipedia). Rocket just got the first release that builds on stable rust. Thus: Give it 15 years, we'll be there!
- andybak 6y agoI used Django from pretty much it's first public release and it was broadly feature complete back then.
- StavrosK 6y agoThe ecosystem between then and now is night and day, though, and that's an extremely important part of a framework.
- strogonoff 6y agoIn case of Django, I actually don’t feel much difference in this regard—it’s always been very much batteries included. It is natural for a project to have no dependencies but Django (and maybe psycopg2 bindings), business domain-specific dependencies excluded. Happily used it since before the first major release.
- eli 6y agoIt had been in production use for a while prior to its public release, yeah?
- steveklabnik 6y agoIIRC, it was (like Rails) extracted from an existing web application.
- bluejekyll 6y ago> Rust web frameworks do not let you easily test your application's database access layer nor provide advanced authorization Can you expand on this comment a bit? I find testing in Rust to be fantastic. Rocket makes for calling test functions simply via standard rust in tests, though you’ll need to build some test harness boot strap for your DB, but you generally end up doing that in any language for functional/end-to-end tests.
- WJW 6y ago> you’ll need to build some test harness boot strap for your DB You kinda answered your own question here. Rails and Django have built in support for end-to-end and functional tests, including database access in the same way as the normal app, all autogenerated. That is just table stakes for web frameworks these days.
- bluejekyll 6y agoI’m not super familiar with Django, but don’t you still have to run all your db upgrade scripts, etc? Does the Django framework handle that for you?
- dnautics 6y agoDjango implicitly generates migrations from your class structure. It's a choice, but it works very well up to a point that 90% of simple web apps will never get to.
- thomaslord 6y agoI think this probably covers it: > you’ll need to build some test harness boot strap for your DB From what I've seen, it's totally possible to use Rust for web development. However, there are tons of web frameworks in various languages that provide way more out of the box than you can find in Rust. These frameworks have had tons of time to mature - Ruby on Rails is 16 years old, Django is 15 years old, Laravel is 9 years old, and so on. I think (and hope) Rust will get there eventually, but I think it'll take some time. There's a lot of hype, but speaking as a web developer who's interested in Rust I think there will need to be a lot more tooling and a lot of educational content before it gains any significant market share. I got my start with C/C++ before I ever touched web stuff, but I never got too far into advanced language features. That combined with not having written a serious C program in years makes Rust something I'd really have to commit to learning, so even though I'd love to have a faster better-typed alternative to PHP I won't be writing any actual webapps in Rust in the near term. Basically, I think most of the people writing webapps in Rust will be Rust people interested in the web rather than web people interested in Rust for a while. There are of course organizations that do more complex stuff on the web and will jump on this sooner, especially places that use microservices and don't have to move their whole platform over, but many people building simpler sites with smaller teams will wait until there's a substantially larger ecosystem.
- ibraheemdev 6y agoI am the author of the updated home page. Although the main content was provided by a previous maintainer of the website. No one is saying that Rust dev will be as smooth as Django. In fact, there is another paragraph right below: > While development might not be as smooth as something like Rails or Django, the Rust web development ecosystem and community is engaged and very helpful. A lot of work has been put into the web in the past few years, and we're getting there! You can replace a Django app with Rust. While you might have to put in extra work to: > test your application's database access layer > provide advanced authorization The main point that the author wanted to make is that Rust is suitable for scale web development. It might not be perfect, but we are getting there, and the ecosystem and community is very large, engaged, and helpful.
- nicoburns 6y agoI would consider removing the reference to Django. Rust frameworks are great and make an excellent alternative to flask/sinatra/express, but they are nowhere close to as full-featured as Django/Rails/Laravel. Those frameworks are a whole other class of thing which I hope the Rust ecosystem will eventually aspire to, but it's not there yet.
- gremlinsinc 6y agoI wish there were a Laravel for Rust. I've tried rocket/actix but laravel's ease to launch an app from cli, and organize code structure, configs, etc... makes life much easier. Go kind of has a few (Buffalo and Beego), waiting for a true MVC framework for rust.
- devsquid 6y agoI love Rust and I love the direction its pushing. But these kinds of websites are awful. If you can't get the nuances why Rails/Django/Many other frameworks are a better solution for writing a web server than I dunno what to tell you.
- ibraheemdev 6y ago> But these kinds of websites are awful Care to share why? It provides a lot of useful information and curated packages for common categories. It is actually widely used as a reference for package selection. Just because you disagree does not make it "awful"
- devsquid 6y ago> Can I replace my Rails/Django/Flask already? Yup! Rust has mature and production ready frameworks > If you can't get the nuances why Rails/Django/Many other frameworks are a better solution for writing a web server than I dunno what to tell you.
- AlchemistCamp 6y agoIt's awful because dishonesty is awful. I'm enthusiastic about learning Rust myself, but it's not even remotely a replacement for Rails. Rails is, IMO, bar-none the fastest prototyping / solo dev tool for building CRUD apps that there has ever been. It made it possible to build a blog in under fifteen minutes in 2005. In 2020, it's even more productive and for an even wider variety of applications. What Rust framework is even remotely similar?