Ask A Question

Notifications

You’re not receiving notifications from this thread.

GoRails Performance - The Techniques I Use Discussion

Itzik Ben Hutta Itzik Ben Hutta

Thanks Chris. The first time my name appears on a video :)

Reply

Heck yeah man! :D

Reply

Thanks for episode Chris. But what happens when turbolinks mess up and do not let your javascript code run when you "change" page? because i have had these issues here and there and i had to do something like data-no-turbolink.

Reply

Hey Pete, this usually happens from one of two things:

1. You're using a third party library (like Segment.io for example) that isn't compatible with Turbolinks events by default. These usually require some tweaking in order to make compatible. It all depends on the library but there are usually ways to do it. You can google for that library + turbolinks and see if anyone else has made it work, or if you can tweak it yourself.

2. Sometimes it can just be a simple setup issue if your JS is running incorrectly. Maybe you need the jQuery.turbolinks adapter, or just to modify your code slightly to allow running on multiple pages.

It all kinda depends on your code and the issues you're experiencing. They can be kinda hard to track down so the easy solution is to turn off turbolinks for those links in the meantime if you can figure it out. I don't think there's anything wrong with that so you can figure it out later.

Reply

Great insight! Though now I'm really hoping you'll do another video on how to implement and get the best out of Turbolinks. Few resources out there and you did a good job with the marketing :D

Reply

I definitely will. I also need to learn some around Swift and Android so that I can make some example apps using the Turbolinks adapters. That might mean we'll have a GoRails mobile app at some point. :)

Reply

Another suggestion is a non-rails issue, but fundamental nonetheless: focus on the database queries themselves. A great suggestion I have held dear over the years is to ask "what are the critical queries an application may have?" (the most frequent one, the most valuable, the most calculation intense...) On that basis, with a knowledge of how databases index, one can often find a data structure that is more efficient than another (conception over optimisation). Large test data sets for different data structures allow to validate design choices. To me, that is the core of the onion...

Reply

Thanks Chris!

Reply

Chris, any chance you could go into detail about how to set up nginx and passenger to properly utilize the resources of your server? I follow your guides when installing so no fine tuning is ever done to my servers. Also would love to see how to set up redis for caching.

Reply
Anthony Lee Anthony Lee

Thanks Chris. I would love to see how you make improvements on all the external API calls for getting data from different services.

Reply

im in the Video yay lol Chris keep up the good work

Reply

Whoo! :)

Reply

Does your 2GB droplet contain your entire stack (db/cache/nginx/passenger) or did you break out the db/cache?

Reply

It also contains the DB and cache because neither are that large. I still have 400MB of RAM free right now.

Reply

I would love to watch a serie , instead of a bunch of randoms episodes, something like laracasts but for rails..... A lot of people will pay for that

Reply

I've been realizing I need to make that transition soon anyways just because there are way too many screencasts to keep track of at this point. :)

I'll probably be migrating to a bunch of small series over the next few weeks!

Reply
Jordano Moscoso Jordano Moscoso

Question, maybe to clarify some things, if you can, please answer, thanks.
Why did you choose digitalocean over heroku?
PD: Im thinking about changing to digitalocean because in heroku every add-on in production mode is paid, and if you have few your are going to paid 3x times more than having a digitalocean($20). But i not sure if i'll make the right things in digitalocean.

Reply

I chose DO because I like running my own servers and its significantly cheaper than running on Heroku for personal or small business projects. You'll have to do a lot more work, but it can be fun so long as you make sure you have backups and all that in place.

Reply

I’m watching this for the first time now (in 2021) and it’s awesome to see how spot on Chris is with his use and recommendation of Turbolinks.

Reply

Very helpfull as always, thanks Chris!

Quick question:

  • What would happen in the hypothetical "exaggerated" case of upgrading the Digital Ocean plan to, say, 256GB of memory. All other things being equal, would this fix the loading speed and overall site performance without the need to optimize the frontend, assets or cache?
Reply

More RAM would help you run more Rails processes at once so you could serve more users at once, but each individual request will still need to be optimized to run as quick as possible. Caching & optimizing assets is still important and a bigger CPU can help process requests slightly faster.

Reply

Awesome Chris, thanks for your response!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.