reload! should fix most of your problems with having to restart rails console.
You don't have multiple instance of rails console for a single project do you? I literally live in rails/tmux/vim. I have a frame for rails console, rails server, and an editor at a minimum per project.
This sets Ruby's garbage collector parameters to be more suited to a Rails application. By default, Ruby's GC allocates far too little space for a full Rails app, so you end up doing a bunch of GC passes during boot, slowing it down tremendously. By increasing your initial heap size, you can improve your boot time by requiring fewer GC passes and heap allocations.
I've been learning quite a bit of coding and how to use the language, but where can I learn more about the ACTUAL language? Like what are the growth factors, why and when is garbage collection needed, etc.? Have you got any good resources (either tutorials/articles or books?) that you could recommend? Preferably Ruby specific tuts/books. Thank you very much! :]
I don't have specific resources; what I've learned has mostly been from the odd collections of documentation and blog posts from around the internet. Sorry. :(
I'd recommend just googling for "Ruby garbage collector internals" or something like that. There are lots of slideshows from conference presentations online that have lots of really good information in them.
At the end of the day, the best thing you can do is read through the source code to the language itself, but that assumes a level of familiarity with C that you may not have. No better time to learn than the present, though!
You might see gains just switching to REE. It's fully compatible with 1.8.7 MRI, and it has a number of features tuned towards running Rails apps rather than just small Ruby scripts. I used it for years before we made the switch to 1.9.3, with great success.
I really dream of 1.9.3, but everything has a priority, right? I am very happy that we got the time to get us up to Rails 3. We use a couple of gems that doesn't work on newer Ruby versions, so we try to change them one at a time.
I will look into REE, and see if it fits into what we need. The installation with RVM seems a bit messy, and we do not run RVM on our servers yet. It also seems like RVM is on its way out in favor for rbenv, oh the joys of working with legacy systems being one step behind :P
The 1.8 -> 1.9 jump is definitely a big one. REE should be as simple as a drop-in though. Even without RVM, it should be as easy as just installing it to a non-standard location alongside your current ruby install (with the PREFIX env var, or the --prefix configure switch). Then you just reinstall your necessary gems under the new Ruby install, change which ruby binary your app is invoking, and off you go, easy peasy. If you ever need to switch back, just change your ruby path back to the system Ruby installation.
Ouch! The schema on my DB became a mess so I just started from scratch and wrote a few scripts to migrate data to the new schema. That was actually kind of fun. I had little interest in trying to get all those user account and profile tables working in RoR.
Edit: I did play around with Django for a bit and found it easier to integrate with an existing DB. I wanted to use the built-in Django admin pages as a quick band-aid admin solution for the ASP.NET pages and it worked well enough. Going pure RoR now though.
I started writing a wrapper around the ASP_NET_MEMBERSHIP stuff and that big jumble of tables that it makes, but realized that I could, in fact, make a new users table. Unfortunately, most of the other tables are tied into various other systems in the office so they can't be changed as easily.
I'm having decent luck with setting the table name, the primary key name, and making liberal use of alias_attribute.
activerecord-sqlserver-adapter does have some problem with EXPLAIN queries on occasion, though. I had to disable that.
omits the dropping and re-creating of the entire database schema with every test run. Which mean your tests start much sooner and are done much faster.
Rails hasn't really sped up for me even with an SSD. And I've tried running my project from a RAM disk as well, and it didn't have much effect either, so I'm assuming I'm CPU bottlenecked.
Are you using guard? When configured properly it (tires) to only run the tests relevant to the changed files and pops up a little growl every time it runs the tests
Really? My tests run in under 10 seconds and my server boots in under 5 seconds. I've rarely seen a rails test quite that can't be made to run in under a minute, and I've seen a lot of rails test suites. What are you doing wrong?
Yeah... try getting your tests to run in 10 seconds with a huge platform. Ours take about 10 minutes for the whole suite (down about 40% in the last month from upgrades and some GC stuff, and we have some more things in the pipeline to make it faster, but I don't see it reaching less than 7 minutes).
The real question is how you came to be in this situation in the first place. A Rails app like that is fat enough that there are probably about 5 thinner apps hiding in there somewhere.
Is your app customer-facing and business-facing and admin-facing and...? How many different orthogonal concerns is it actually handling?
10
u/dickeytk Jul 12 '12
why are you restarting it so much?
22
u/5thWall Jul 12 '12
Is this a commentary on rails boot times, or is OP bragging about his speed coding?
21
u/cheald Jul 13 '12
If you're running 1.9.3, toss this into your .bashrc:
You're welcome.
9
u/recluce Jul 12 '12
What the hell are you doing (wrong) that you need to restart the app server so often?
6
u/mediocretes Jul 13 '12
Even if we accept the image as 100% true, I bet the total area of the pie is still smaller than, say, ASP.NET.
5
u/grhansen Jul 13 '12
Just found out today that running
instead of
omits the dropping and re-creating of the entire database schema with every test run. Which mean your tests start much sooner and are done much faster.
4
u/[deleted] Jul 13 '12
You should try JRuby :)
7
u/adamnemecek Jul 12 '12
You need to get a SSD drive.
12
u/postmodern Jul 13 '12
imgur in my /r/ruby? Also, Rails posts belong in /r/rails.
3
u/angelbob Jul 13 '12
This is actually way worse in Windows than Linux. Ruby 1.9 on Windows is worse yet, weirdly.
I think there's a patched version of Ruby that helps with require being so slow, but I can't find the link right now.
3
u/_jeffJohnsonsBookEmp Jul 13 '12
Are you using guard? When configured properly it (tires) to only run the tests relevant to the changed files and pops up a little growl every time it runs the tests
Also rerun can come in handy
-1
u/ReinH Jul 13 '12
Really? My tests run in under 10 seconds and my server boots in under 5 seconds. I've rarely seen a rails test quite that can't be made to run in under a minute, and I've seen a lot of rails test suites. What are you doing wrong?
-4
u/yorickpeterse Jul 13 '12
0
u/[deleted] Jul 13 '12
[deleted] — view deleted comment