Live data from Hacker News

Rails 5.0: Action Cable, API mode, and more

weblog.rubyonrails.org

61–70 of 225 posts

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

#61
All my new development these days centers around node + browserify/webpack with a react frontend, or just plain javascript for small projects.

WebSockets would have been a cool addition four years ago. There is little compelling case for new development. Sorry to be so harsh.

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

#62
post #40
post #25

Earlier quoted context omitted.

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…

Interesting we saw about a 50% performance hit when trying jruby and also a 15% hit on memory usage- it was a no go for us

That's not surprising, it has some real problems with certain code, the edge cases are bad sometimes. We had a 20% perf bump, but probably 4x the memory use. That said, it gets better every release, and the JVM tooling is quite nice.

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

#63

We've moved all of our backend offerings from Rails to Elixir/Phoenix. Despite some questioning the value of anything below 100ms response times there is a lot of data backing up the idea that Elixir/Phoenix can lead to a more maintainable and more economical solution. I spoke about this recently at RailsConf: https://www.youtube.com/watch?v=OxhTQdcieQE Don't get me wrong, I think Rails is an amazing technology but i…

Every time I've explored alternatives to try to get those kinds of numbers, it seem the bottleneck is more in the database than the application server.

How granular are your measurements? I'm certainly not calling your experience into question. But I wanted to relay a cautionary tale of my own.

On one project my team was convinced that Redis was our bottleneck. Profiling was showing that Redis calls were where the most time was spent. I spent some time looking at the redis-rb source and it does a lot of block nesting (4 or 5 levels for every call, IIRC). So, I tried replacing the redis-rb client with something a bit lower level and our throughput doubled. It turned out that all that block processing cost as much as the network call did.

I suppose this isn't all that new: many performance issues are really a "death by 1,000 cuts" situation. Oftentimes your profiler can lead you astray.

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

#64
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.

It's not an omission per se, it's actually a challenging thing to implement. I'm sure they'd have done it sooner if it wasn't so hard to get right. Think of how the precedence rules would work: especially since the queries are composable, tacking on another .or() can do funny things semantically.

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

#66
post #64
post #5

Earlier quoted context omitted.

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

It's not an omission per se, it's actually a challenging thing to implement. I'm sure they'd have done it sooner if it wasn't so hard to get right. Think of how the precedence rules would work: especially since the queries are composable, tacking on another .or() can do funny things semantically.

I think I chose my words poorly. I'm sure it was a huge undertaking, but the lack .or() is very noticeable in AR if you're coming from other ORMs or straight SQL.

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

#68
post #7

Looks like a solid and and relatively straightforward upgrade from Rails 4.2. It's hard not to feel Rails has become a bit of a slow-moving behemoth though, with this release four years after 4.0. I've still got a couple clients using 3.2 from 2012 and things aren't that different. Smart money at this point seems like a significant portion of the Rails community could begin moving to Elixir/Phoenix over the coming ye…

The upgrade is anything but easy if an existing application uses protected attributes extensively (removed from Rails 5). Because protected attributes does a shitload of monkey patching it's hard to know exactly what side effects its removal might have, especially in any application that uses nested attributes for mass assignment/initialization of a model's relations.

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

#69
post #33

I feel bad for Sean Griffin. He spent over a year overhauling the internals of ActiveRecord to add this attributes API. His work dramatically improves coercion and type enforcement for ActiveRecord users. Seems weird for this to only get a non-descriptive bullet point in "other highlights." Here are the docs if anyone is interested: http://edgeapi.rubyonrails.org/classes/ActiveRecord/Attribut...

I'd love to read more about it. Do you know if he has written anything about this work?

Most in depth I went was probably in http://m.youtube.com/watch?v=PUuYAksQWg4 but I discuss it in pretty much every talk I give.

You can also just ping me on Twitter and I can talk about it more. :)

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

#70
post #33

I feel bad for Sean Griffin. He spent over a year overhauling the internals of ActiveRecord to add this attributes API. His work dramatically improves coercion and type enforcement for ActiveRecord users. Seems weird for this to only get a non-descriptive bullet point in "other highlights." Here are the docs if anyone is interested: http://edgeapi.rubyonrails.org/classes/ActiveRecord/Attribut...

I'd love to read more about it. Do you know if he has written anything about this work?

Sean gave a (great) talk at RailsConf covering the attribute work as well as other Rails5 features "that you haven't heard of".

http://confreaks.tv/videos/railsconf2016-rails-5-features-yo...

Post reply on HN