Live data from Hacker News

Rails 5.0: Action Cable, API mode, and more

weblog.rubyonrails.org

141–150 of 225 posts

Re: Rails 5.0: Action Cable, API mode, and more

#141
post #22

Looks like now's a good time to mention that the Ruby on Rails Tutorial book has already been updated for Rails 5: http://railstutorial.org/book Sales actually just launched on Tuesday (announcement here: https://news.learnenough.com/rails-5-edition-of-rails-tutori... ), and you can pick up your copy of the new 4th edition here: http://railstutorial.org/code/launch That link includes a 20% launch discount, which expi…

I owe my career in large part to your work. Thank you.

Re: Rails 5.0: Action Cable, API mode, and more

#142
post #52

Earlier quoted context omitted.

I would love to see someone take a deep dive into why their Phoenix thing is "so much faster" than with Rails. I mean really look at the whole stack from the VM, to different pieces of the framework like views and DB interaction. Erlang definitely does concurrency well, but it is not that much faster than Ruby in terms of "raw speed". I'd be fascinated to see someone actually do the work and look at where Phoenix is…

It sounds like you're undervaluing concurrency. Concurrency is huge for a web application. If you were say doing image manipulation or other DSP where you needed "raw speed" you'd want to choose a language like C, Go, Rust. But in a web application you're handling hundreds, thousands, to millions of requests per second; concurrency is crucial for that kind of throughput. A developer on my team did some quick benchmar…

Yes, concurrency is better - way better - in Erlang, but I'd like to see things broken down in detail. Show times with 1 client, 10, 100 etc...

Re: Rails 5.0: Action Cable, API mode, and more

#143
post #124

Earlier quoted context omitted.

> Being able to handle large traffic spikes and continous connections is a game change from what I found This isn't specific to Elixir/Phoenix/Beam. > Some parts of the cluster would be crashing and restarting for a while, and there would be no need to wake everyone up Like any well-designed system that separates concerns. Again, this isn't language or framwork-specific. This stuff is what frustrates me most about th…

> these are all things that can easily be attained with just about any well-factored system on any number of languages/frameworks Not sure what your point it. I shared my experience working with systems, you can share yours (if you have any). Yes, you can write any of the stuff in assembly. Erlang, Java, Rust, all can be written in assembly. You can serve web pages in that too, and even create distributed system by t…

Since this is a thread about RoR5, perhaps the "early adopters" comment was targeted at the proponents of Phoenix/Elixir who fail to demonstrate any of the shortcomings of their chosen framework rather than people who have been relying on the reliability of their resilient BEAM to efficiently make a living for the past 30 something years.

Re: Rails 5.0: Action Cable, API mode, and more

#144
post #52

Earlier quoted context omitted.

I would love to see someone take a deep dive into why their Phoenix thing is "so much faster" than with Rails. I mean really look at the whole stack from the VM, to different pieces of the framework like views and DB interaction. Erlang definitely does concurrency well, but it is not that much faster than Ruby in terms of "raw speed". I'd be fascinated to see someone actually do the work and look at where Phoenix is…

From what I've read in the comments so far, you won't see it thinking in terms of speed of Erlang vs Ruby. It sounds like the gains come from baked in behavior, so that "Rails + Redis" or "Rails + Redis + nginx" is equivalent to Phoenix alone. I'm still only reading about this, though. No Elixir experience here.

Erlang definitely does a lot out of the box without needing to rely on other systems and that's a great thing, but we're hearing claims about "fast" and "more maintainable" and I'd like to see more details.

I used Erlang at the last place I worked and like it a lot, but Rails is pretty good too in my book.

Re: Rails 5.0: Action Cable, API mode, and more

#145
post #5
post #3

This has been long awaited: Post.where('id = 1').or(Post.where('id = 2'))

Seriously, .or() always felt like a glaring omission.

I wrote it in SQL when I needed it, after all I knew SQL before AR came around. An OR is very rare and probably that's why it landed only in version 5.

Another implementation is Post.where(id: [1, 2]) which is SELECT * FROM posts WHERE id IN (1, 2). I guess a db would compile it into exactly the same code (dbs use different terms but that's what it is) but the performances could be different inside AR/Arel.

Re: Rails 5.0: Action Cable, API mode, and more

#146
post #25

Earlier quoted context omitted.

I just dont see how ruby can overcome the vm disadvantage to be honest I don't know how mature it is, but couldn't jruby be the answer to this?

I use jRuby, which is great and an amazing piece of engineering. However, with Rails, you're only see about a 20% speed bump and out of the box it uses too much memory to run on Heroku's free tier. You'll also miss out on the gems with c extensions (for now I think that's about to change). Additionally, there seems to be a performance regression around includes and case statements. Your devops story can also be a bit…

JRuby is painful to develop with compared to MRI. Running a test suite is slower, everything is slower even if you turn off JIT to startup the JVM faster and do other tricks that I don't remember. That's why Java developers usually work in IDEs that keep compiling and doing hot reloads constantly. Maybe that could apply to JRuby. Anybody here has experiences with a Ruby IDE and JRuby? Do you?

Re: Rails 5.0: Action Cable, API mode, and more

#147

I actually don't like rails' convention over configuration school of thoughts. It makes everything implicit. For any large rails app it's difficult to reason about how things are working, unless you learn all the conventions by heart (by the way, these conventions don't seem to be documented well)

If you are a Rails developer you know all the conventions and they help you at finding code with only an editor and a file manager. No need of IDEs. It's very easy to learn a new application, unless the original developer wanted to be clever, which usually means that was one of his/her first Rails projects.

However there are other school of thoughts and not everybody likes the Rails way. It's fair and it's a big world with space for every opinion and tool.

Re: Rails 5.0: Action Cable, API mode, and more

#148
post #52

Earlier quoted context omitted.

I'm still fairly new with Elixir/Phoenix (as I think most of us still are), but so far I feel intuitively that it's more maintainable and I admit that I don't have the experience or numbers to back that up yet. There are some things that you simply must use other tools for in Rails, because it can't maintain state like Erlang can. Once you start adding in these other things, you're no longer just a "Rails app" but yo…

I would love to see someone take a deep dive into why their Phoenix thing is "so much faster" than with Rails. I mean really look at the whole stack from the VM, to different pieces of the framework like views and DB interaction. Erlang definitely does concurrency well, but it is not that much faster than Ruby in terms of "raw speed". I'd be fascinated to see someone actually do the work and look at where Phoenix is…

Some bigger details why phoenix is so fast despite erlang being a "slow" language:

- macros: fancy syntax and "magic" can be resolved at compile-time. Less work to do on runtime.

- templates: they get handled at compile-time, too, resulting in functions with blobs of binaries. This matters a lot, since a specific template-binary exists only once throughout the application and gets re-used whenever needed. This way you get near instant templating, instead of the usual string processing on every request.

- dispatching code like the routing that must be done on every request is like rails a DSL, but actually a macro, that gets compiled down to basic pattern matches, which is extremely fast.

- the concurrency model is extremely lightweight, handling more requests and/or doing more stuff per request is much more efficient hardware-wise. Indirect performance gain.

Just a few points that have a very noticeably impact, there are probably more. It boils down to the erlang vm's concurrency and pattern matching performance, plus elixir's compile-time macros and the fact that they treat strings as immutable binaries.

Re: Rails 5.0: Action Cable, API mode, and more

#149

I wish I had API mode 4 years ago

You could have! It was reverted, so we made https://github.com/rails-api in the meantime, and this was finally (literally four years later) pulled upstream now.

haha Thats funny. I was always hacking my way around this problem and landed on Padrino and Flask.

Re: Rails 5.0: Action Cable, API mode, and more

#150
post #22

Looks like now's a good time to mention that the Ruby on Rails Tutorial book has already been updated for Rails 5: http://railstutorial.org/book Sales actually just launched on Tuesday (announcement here: https://news.learnenough.com/rails-5-edition-of-rails-tutori... ), and you can pick up your copy of the new 4th edition here: http://railstutorial.org/code/launch That link includes a 20% launch discount, which expi…

I learned Rails through this book, which kickstarted my way into tech. It's an excellent resource that not only teaches you Rails, but also developing software as a professional.

Thank you so much Michael.

Post reply on HN