7 ms·
Git Push Heroku Master: Now 40% Faster
- d0m 13y agoThat's great! My biggest problem right now in term of deployment time is to sync with amazon for the assets. It literally takes 5 minutes for a small website..
- nthj 13y agoYeah, that's frustrating. I might suggest you just serve them from your app [1], and use CloudFront with a custom origin to take over from there. I can deploy a Rails 4 app in ~20 seconds. [1] http://guides.rubyonrails.org/configuring.html#rails-general-configuration http://guides.rubyonrails.org/configuring.html#rails-general...
- dataviz 13y agoHave you tried dedicated CDN service?
- friism 13y agoAt Heroku we now [recommend using AWS CloudFront][1] to serve assets, backed by your app running on Heroku instead of with S3. It's a much simpler setup with less state and fewer moving parts - and builds are faster :-). [1]: https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn https://devcenter.heroku.com/articles/using-amazon-cloudfron...
- beambot 13y agoIsn't this still problematic with SSL? Last time I checked, you had to pay $600/mo for a custom CloudFront SSL cert if you wanted to pass through the credentials from your own domain. (Using mixed http/https was not an option.)
- friism 13y agoIt's true that this is a problem if you insist on serving your CDN assets a custom domain CNAME mapped to CloudFront (i.e. https://assets.mydomain.com/ https://assets.mydomain.com/). It doesn't cost extra if you just use the default CloudFront distribution URL, i.e. https://d3vam04na8c92l.cloudfront.net/stylesheets/application-6502e5a88f02b90aeb32c2dd21ea37ab.css https://d3vam04na8c92l.cloudfront.net/stylesheets/applicatio... This is not entirely clear from the Heroku docs, I'll ping the maintainer for an update.
- nthj 13y agoOne cool trick for serving mixed http/https that I somehow went 10 years without finding out: you can just point your Rails asset_host to "//d3vam04na8c92l.cloudfront.net". Browsers understand this to mean "Look up this address via whatever protocol I am currently on, http if http, https if over SSL." This is a huge cache boost in Rails because you don't have to cache your pages twice (once for HTTP once for HTTPs.)
- girvo 13y agoOh god.. While your post is cool, I reacted violently to the "One cool trick..." part at the beginning. Upworthy, you've broken me.
- sanderjd 13y agoIs there any real downside to this approach, or is it just that it looks "less professional"?
- neilmiddleton 13y agoNo, you're still serving the same assets. It's only really an issue if your users like seeing where network requests are going and spot the cloudfront URL.
- espeed 13y agoDoes Google have something like CloudFront for Compute Engine? Google gives you edge-cache for free if you use App Engine, but what about GCE?
- ikawe 13y agoThanks, really happy to see this is the officially recommend approach. I've been doing it, but got some uncomfortable knee-jerk reactions from other developers, e.g. "But you should NEVER serve static assets directly!!!". ...but it's only served once!
- nthj 13y ago> e.g. "But you should NEVER serve static assets directly!!!". As with music, painting, and architecture, any development-related NEVERS require that we understand the why, so we can know when to break the rule.
- kmtrowbr 13y agoI have been using this asset_sync gem (with Ruby on Rails), together with S3 & Cloudfront, for 2 years and it works wonderfully: https://github.com/rumblelabs/asset_sync https://github.com/rumblelabs/asset_sync I basically never think about deploying assets. It nearly always just works.
- josephlord 13y agoIt works but they are a bit slow on merging pull requests. I'm currently using a fork so that CORS can work on Rackspace. I think this sort of issue is why Heroku no longer recommend this approach.
- neilmiddleton 13y agoIt's not recommended as asset precompilation usually requires access to the environment (e.g a DB connection), and thus isn't deterministic.
- riffraff 13y agothat seems like a lot of time for a small website. Are you re-uploading the assets all the time?
- aantix 13y agoSomething isn't right. Sounds like you're recalculating the cache digests each time.. Make sure you have your cache store set to dalli (production.rb) config.assets.cache_store = :dalli_store
- sleepyhead 13y agoDon't sync. Compile on deploy and let Cloudfront fetch when needed. It should also be possible to cache assets in memcache instead of compiling on each deploy (personally I ran into some issues with it but can't recall why).
- nthj 13y agoI'm really glad to see Heroku focusing on these types of optimizations. We've been using similar optimization strategies internally at my Rails consultancy for over a year [1], and it's amazing how much fun it is to ship features when you can add a small feature, check your test suite via CircleCI, and be live quickly thereafter. I remember the pain of deploying Huckberry [2] on Rails 3 a couple of years ago. Each deploy took ~6 minutes, and it'd drive us crazy. A whole lot of "Compiling!"-type [3] moments. (Back then, the Asset Pipeline compiled all of your assets twice: once with the real filename, once with the digest-filename: 'filename--f74c093df554be59d45d3c87920eba1f.js'. As you can imagine, this was quite slow.) This is one of the reasons I really love Heroku as a development platform. We're a 4-person shop—we can't spin off a resource to spend 2 weeks speeding up our deployment process. But with Heroku, we wake up one morning, and our processes our 40% faster. It's fantastic. [1] https://github.com/heroku/heroku-buildpack-ruby/pull/96 https://github.com/heroku/heroku-buildpack-ruby/pull/96 [2] https://secure.huckberry.com/ https://secure.huckberry.com/ [3] https://xkcd.com/303/ https://xkcd.com/303/ [edit: formatting]
- brianmcdonough 13y agoThat's great, Now, if only Heroku were 40% less expensive...that would be progress.
- goldenkey 13y agoA little time spent learning how to use a server and build an actual scaling infrastructure, and Heroku turns into dust for dumb dorks. Heroku is the MSFT of servers, lock yourself in, and prepare to feel the bind as it gets tighter. Seriously people, DIY, it isn't hard. Let the "180 websites in 180 days" [1] girl use Heroku, she's giddy to get anything working. Real hackers should not be satisfied with lock-in, ridiculous prices that correlate with the ineptitude of the user-base, potential downtime on top of AWS normal downtime (what Heroku uses in the background.) If you're serious about your business, Heroku makes no sense at all, lest you be a non-technical cofounder, and it makes you feel 'safe.' [1] http://jenniferdewalt.com/ http://jenniferdewalt.com/
- michaelmior 13y agoIt seems you're trying to insult someone who's making an effort to learn some new skills. Not sure what this has to do with the topic at hand. As to the point of DIY not being hard, getting something working may not be hard. But handling fault tolerance, logging, backup, downtime, etc. is non-trivial. And as mentioned in other comments, this takes time. Even if you're a l33t ub3r h4x0r, that will always be true. For some teams, the DIY investment will make sense, others would rather spend their time building features than dealing with ops.
- goldenkey 13y agoThis conversation isn't geared toward insulting Jennifer, it's an attack on the lameness of using Heroku. I think Heroku users should each get a sticker that says 'I'm a proud black box user'
- frandroid 13y agoIf you're serious about your business, maybe you want to spent time building and running the business instead of playing sysadmin. Especially when you're a small team. Let's say you pay Heroku $500 a month, which is already a somewhat mature business. On the other hand, you could pay a very cheap sysadmin $50/hr. So you'd get 10 hours of her time. You'd get way more value out of the $500 for Heroku. My time, as a founder, is worth way more than than $100/hr; I'm not going to get my hands dirty in being a sysadmin.
- sergiotapia 13y agoI wanted to give Heroku a try for a new website my brother and I are building and looking at the costs it's quite steep. $35 for a measly 2 dyno application, and another $50 for a production postgresql database. Our use case is REALLY simple, we aren't building some freak sideshow redis golang nonblocking nodejs mongodb ravendb nqueue sync rabbit hyperthreaded monster. We're just building a Rails 4 site, with a PostgreSQL database backend. That's ENOUGH for our use cases. For what we need it's infinitely cheaper to just rent a Linode/DigitalOcean server, use something like Chef to spin up the services we need and voila. We probably won't have to touch the servers for a very long time. Again: We're doing simple things - CRUD basically. I love Heroku for it's simple usage but it's just too darn expensive for us.
- mattmanser 13y agoHow is this relevant?
- sergiotapia 13y agoI meant to reply to nthj's comment.
- Aqueous 13y ago1X dev dynos are free. If you need to go up to 2 dynos or scale vertically to a 2X dyno then you start paying. You shouldn't really need to use 2 dynos until you actually have to launch. You're going to be spending a lot of time configuring/writing Chef cookbooks and refining your deployment process. This is time that you could be spending developing features and making your application more reliable. That's where the savings come in. It's not more expensive; it's less.
- zarriak 13y agoIt just depends upon what you value doing with your time, whether you value paying more for convenience, or paying less but having to deal with everything. It just boils down to a design choice.
- zarriak 13y agoThe sad thing is, deploying code should be this easy and fast whether or not your are using Heroku.
- joeblau 13y agoJust did a node.js deploy and it definitely felt faster.
- pacifi30 13y agoThis is so awesome. Though I only have 2 servers and repo is not very huge but sometimes it takes close to 10 secs to deploy. A 45% decrease for python is incredible
- whalesalad 13y ago10 seconds? Buddy... You've got nothin to complain about.
- ochoseis 13y agoSo this might be an aside, but given all the complaints about how expensive Heroku is (despite the free tier, how they handle everything below the app, it's the gold standard in PaaS) has anyone tried out competitive services like Cloud Foundry [1], OpenShift [2] or Cloud66 [3]? Cloud Foundry and OpenShift are either hosted with similar free tiers or you can set up yourself, and Cloud66 is more for the DIY crowd being free for development environments. I do appreciate Heroku's free tier for toy projects but if you had to scale on a budget (and could handle the setup) don't know if that'd be a better starting point than the other options. [1] http://www.gopivotal.com/products/cloud-foundry http://www.gopivotal.com/products/cloud-foundry [2] http://openshift.com http://openshift.com [3] http://cloud66.com http://cloud66.com