# (no subject)

**URL:** <https://www.ruby-forum.com/t/no-subject/98736>\
**Category:** Ruby\
**Created:** [July 17, 2006, 9:30pm UTC](https://www.ruby-forum.com/t/no-subject/98736 "2006-07-17T21:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [July 17, 2006, 9:30pm UTC](https://www.ruby-forum.com/t/no-subject/98736/1 "2006-07-17T21:30:34Z")

</div>

> I have a server that is dedicated solely for running a single ruby

> application. Is there a ruby configuration file that I can change to  
> help speed ruby up and take as much resources as it needs? Basically  
> make sure there is no memory limit, processing limit, and give it the  
> highest priority process as possible. Also is there anything else I  
> can do to get the most speed out of ruby?

If you’re using a UNIX like server, you might try running the process at  
a  
higher priority using the ‘nice’ command, or have the ruby program  
change  
it’s priority before and after the critical section of code:

#!/usr/bin/env ruby

ruby\_pid = $$  
…  
%x{ renice -20 #{ ruby\_pid } }

# critical code

%x{ renice 0 #{ ruby\_pid } }

Of course you’ll have to run it as root to be able to change your  
priority  
higher (more negative) than 0.

I would be interested to hear your results.

Regards,  
JJ

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [July 17, 2006, 10:42pm UTC](https://www.ruby-forum.com/t/no-subject/98736/2 "2006-07-17T22:42:40Z")

</div>

John J. wrote:

> it’s priority before and after the critical section of code:  
> higher (more negative) than 0.
> 
> I would be interested to hear your results.
> 
> Regards,  
> JJ

This topic has been addressed many, many times in this group. Do try  
searching it and reviewing the prior posts - many were very helpful.  
One thing I recently read in Enterprise Integration with Ruby was a  
anicdote about an application that was generating tons of small,  
intermediate objects/strings? This caused a lot of garbage collection  
overhead. Storing the intermediate strings in an array so they  
wouldn’t be GC’d resulted in a dramatic performance improvement. So,  
you could consider how GC may or may not be effecting your application  
and see if you can do likewise, since you say memory usage is no  
option. Also, in my personal experience, ALWAYS preallocting objects  
whenever possible can have a not insignificant performance benefit, ie,  
instance objects outside of loops that are used within the loop, rather  
than instancing the object w/in the loop, where it is destroyed and  
then reinstanced on each iteration. Also, have your run the profiler  
over your app? If not, it would be good to do so.

Ken
