by mortallywounded · 3y ago · 0 comments
I really liked Rails and used it for several years, but Go came when Rails was making things difficult.. Ruby's heap memory kept growing and not being released or released too slowly. My server was using 12 GB of RAM and could hardly handle 300 concurrent users.
The Go version uses 25 MB of RAM and can handle many thousands of concurrent users.
edit:
I understand the memory/concurrency issues are not Rails' fault entirely. It's likely ActiveRecord and Ruby as a VM that caused most issues, but it's part of the Rails deal. Getting good concurrency with Rails isn't easy, and memory issues are real.
To each their own though. IMO Rails is significantly faster when it comes to being able to get a complete product to market with all of the trimmings. When it comes to specific programming problems here and there a lot of languages will be able to get the job done.
That holistic "get everything done well with a small team so we can be profitable" scenario is where Rails outshines most everything else.
Plus, if you're concerned about the runtime, just switch to JRuby.
It's not like I was slinging Rails code like a bootcamp graduate :)
Well said
The Rails application was difficult to change (but easy to pump new things out). As the product matured, fewer new features were really needed so the edge Rails had was gone and all that was left was an application that was hard to change without breaking something.
Go's edge came in and reduced the server's memory footprint and was easy to maintain and make changes. If the Go code compiled, I was confident it would work (I never felt that way with Rails).
To answer your question directly: I didn't use any framework. My application only has two external dependencies: gorilla/securecookie (cookie encryption) and lib/pq (database driver for postgres).
I could probably do without securecookie, but I was hesitant to do anything encryption related on my own.
Everything else is standard library Go code.
I'm not "against" frameworks, but there are up- and downsides. E.g. in Rails I had quite some trouble with complex forms, which eventually resulted in form_this[1], which actually worked pretty well for the application I was working on. For a lot of apps you don't need this kind of thing, but when you do, it's quite difficult to do something outside the Rails "happy path". Maybe newer versions of Rails handle this better; I haven't really kept up.
I found the Rails codebase rather tricky at times. You get things like:
[:method1, :method2, :method3].each do |name|
define_method name, [..]
define_method "#{name}=", [..]
define_method "#{name}_foo", [..]
end
And it's really neat you can do that in Ruby, but it can also make a codebase kind of tricky to debug – it's the old "you need to be twice as clever to debug code than to write it". While I generally found Rails to be pretty good, it does have bugs and quirks.On the flipside with Go you spend a bit more time writing your own code, but that code will be better suited to what you're doing. Sometimes people seem to be afraid to write code, but I found it's not a bad thing and "do it yourself" can be quicker and better than "adapt existing thing to your needs".
On balance, it seems to more or less cancel out. Maybe there's some difference one way or the other, but it doesn't seem to be huge.
I wrote a clean sheet Rails form helper library at https://github.com/rubymonolith/superform that’s completely customizable and even permits its own strong parameters.
Haven't see anyone actually using them in production though.
Tried beego some time ago and everything felt out of place, websites not working, unresponsive dev's on github and so on.
Today i'am happy with the standard lib + mux + some otheer libs for other functionalities, it's just more work than rails but this also works!!
The rewrite was definitely a good idea by the sound of it, but of course you had prototyped your way to a stable vision of what you actually want the monolith to do using RoR. Good Job!
Rails' deep integration with view layer unlocks a great level of productivity.
Yes. Unless you are builing a static site.