# Moving from VPS to dedicated box. Thoughts re Xen?

**URL:** <https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903>\
**Category:** Deployment\
**Created:** [January 30, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903 "2007-01-30T18:35:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 30, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/1 "2007-01-30T18:35:25Z")

</div>

I’m going to be moving from a VPS to a dedicated box in the next few  
weeks and am thinking about configuring it with Xen, and wondered if  
anyone had any thoughts about this and specifically how the various  
instances should be set up.

Bit of background – I’m not a computer professional by background.  
Got into it through sorting the IT for a small company I ran and  
ending up building our website (PHP hackery) and setting up a couple  
of Linux boxes. Rails (and Ruby) have been a revelation, and added  
some sorely needed structure to my coding. All this means I’m learning  
as I go along, and sometimes it’s a steep learning curve (for example,  
I’ve had zero experience of Xen).

Currently I’m on a VPS with 160MB of Ram, running Debian 3.1, nginx  
and mongrel-cluster, all of which is fine (well, Debian’s a bit of a  
pain sometimes, what with having to building half the things you need  
from source because the sources are too old, but it’s a pain I’m sort  
of familiar with).

So, questions:

1. Xen – a good idea at this stage?
2. Debian – the right distro for Xen, or would Ubuntu server be  
better?
3. How should I divide the instances – I’m thinking, for the moment,  
of nginx + mongrel instances on one instance, MySQL on another, and  
possibly asset storage (photos, cached files) on a third.
4. I’m using the db for sessions at the moment and only using fragment  
caching, on the FS. Should I rethink these and look at memcached  
(something else I know nothing about)
5. What about memory allocation between the instances (and would 2GB  
be a reasonable amount of total memory to start with)
6. Any gotchas?

Hope I’m not taking the piss with all these questions. Any suggestions  
gratefully received,  
Chris

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 1:37am UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/2 "2007-01-31T01:37:15Z")

</div>

On Jan 30, 9:57 pm, “ChrisT” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. Debian – the right distro for Xen, or would Ubuntu server be

Debian decided to go with OpenVZ [[http://openvz.org/](http://openvz.org/) ], so the  
packages are in etch by default. Ubuntu decided to go with Xen, so you  
can find all needed packages in edgy.  
If it is just for security separation, take a look on OpenVZ - not a  
bad option at all 😉

Memcached? Will you REALLY have a LOT of instances? Because memcached  
make a sence just in this case - shared storage. My opinion: go with  
AR session store and if not fast enough - sql sessions store [ http://  
[railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-](http://railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-)  
store ]

Gotchas? nginx is good with serving static files (assets), why to not  
put them together (nginx+assets) and have mongrels in another container

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 2:41am UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/3 "2007-01-31T02:41:18Z")

</div>

On 1/30/07, ChrisT [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m going to be moving from a VPS to a dedicated box in the next few  
> weeks and am thinking about configuring it with Xen, and wondered if  
> anyone had any thoughts about this and specifically how the various  
> instances should be set up.

Congrats. I think this is a really forward looking solution.

If you deploy on a single box in this fashion, when the traffic comes  
you’ll  
have an entirely clear path to expanding:

1. Order new box
2. Install Xen
3. Determine which process is causing pain
4. Move already entirely configured environment onto new box
5. Revel in the new speed
6. Realize you could have done 4 _while the instance was running_, if  
you had SAN storage!

> All this means I’m learning  
> as I go along, and sometimes it’s a steep learning curve (for example,  
> I’ve had zero experience of Xen).

The extra overhead of learning a few critical Xen commands to manage  
the system is trivial compared to the advantages, IMHO.

> So, questions:
> 
> 1. Xen – a good idea at this stage?

🙂

> 1. Debian – the right distro for Xen, or would Ubuntu server be  
> better?

I’d recommend Gentoo, but that’s just me.

> 1. How should I divide the instances – I’m thinking, for the moment,  
> of nginx + mongrel instances on one instance, MySQL on another, and  
> possibly asset storage (photos, cached files) on a third.

I’d split them this way:

1. nginx with the shared storage mounted, proxying to:
2. at least two separate instances running mongrel\_cluster, each  
accessing
3. NFS storage for this instance and
4. MySQL on its own instance and
5. a MySQL replica because you’ll be happy to have it when you need  
it, and it makes backing up the DB while the system is live very easy.

> 1. I’m using the db for sessions at the moment and only using fragment  
> caching, on the FS. Should I rethink these and look at memcached  
> (something else I know nothing about)

I wouldn’t worry about it until you need it. When you do, bring up new  
Xen  
instances for memcache.

> 1. What about memory allocation between the instances (and would 2GB  
> be a reasonable amount of total memory to start with)

1. nginx @ 128M-192M
2. mongrel\_cluster instances @ 256M-384M (determined by actual usage)
3. I’m really not sure what an NFS server needs, probably 128M-256M
4. MySQL @ 512M-1024M (I’d basically give it whatever you don’t use  
elsewhere)
5. MySQL replicas require very little RAM

> 1. Any gotchas?

Always. 🙂

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 9:08am UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/4 "2007-01-31T09:08:39Z")

</div>

stoyan wrote:

> bad option at all 😉
> 
> >

Stoyan  
Thanks for this. V. useful.  
Cheers  
Chris

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 9:06am UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/5 "2007-01-31T09:06:39Z")

</div>

Tom M. wrote:

> > So, questions:  
> > I’d recommend Gentoo, but that’s just me.
> 
> 1. at least two separate instances running mongrel\_cluster, each accessing
> 
> 2. I’m really not sure what an NFS server needs, probably 128M-256M
> 
> 3. MySQL @ 512M-1024M (I’d basically give it whatever you don’t use elsewhere)
> 
> 4. MySQL replicas require very little RAM
> 
> > 1. Any gotchas?
> 
> Always. 🙂

Tom  
Many thanks for all this great info. Much appreciated.  
Cheers  
Chris

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 3:24pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/6 "2007-01-31T15:24:24Z")

</div>

Stoyan,

> Memcached? Will you REALLY have a LOT of instances? Because memcached  
> make a sence just in this case - shared storage. My opinion: go with  
> AR session store and if not fast enough - sql sessions store [ http://  
> [railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-](http://railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-)  
> store ]

SQL Session Store is easy to setup and faster than AR, there is no  
reason to try first with AR for sessions.

This list rocks.

–  
Aníbal Rojas

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [February 1, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/7 "2007-02-01T14:56:25Z")

</div>

Tom,

> Down that road lies the (personally experienced!) insanity of  
> pre-optimization of everything, because it’s _all_ easy.
> 
> Only…it’s not. 🙂 And even if it was (or is!) it takes time and  
> must be maintained.
> 
> I think sql-session-store is super-cool, and I cannot express my  
> thanks to Stephan Kaes adequately, but most people simply don’t need  
> it (immediately).

I completely agree with you, but (in my experience) the setup and  
maintenance of AR Sessions Store and SQL Session Store are just the  
same. So why don’t use the fastest one? And yes Stephan must receive  
some kind of recognition from the community for his bright work 🙂

–  
Aníbal Rojas

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [January 31, 2007, 8:27pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/8 "2007-01-31T20:27:59Z")

</div>

On 1/31/07, Aníbal [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Memcached? Will you REALLY have a LOT of instances? Because memcached  
> > make a sence just in this case - shared storage. My opinion: go with  
> > AR session store and if not fast enough - sql sessions store [ http://  
> > [railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-](http://railsexpress.de/blog/articles/2005/12/19/roll-your-own-sql-session-)  
> > store ]
> 
> SQL Session Store is easy to setup and faster than AR, there is no  
> reason to try first with AR for sessions.

Down that road lies the (personally experienced!) insanity of  
pre-optimization of everything, because it’s _all_ easy.

Only…it’s not. 🙂 And even if it was (or is!) it takes time and  
must be maintained.

I think sql-session-store is super-cool, and I cannot express my  
thanks to Stephan Kaes adequately, but most people simply don’t need  
it (immediately).

–  
– Tom M.  
– CTO, Engine Y.

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [September 25, 2007, 11:05pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/9 "2007-09-25T23:05:39Z")

</div>

That is my opinion of Xen 🙂 It’s great as a way to segment  
applications for security purposes in say a shared hosting  
environment, it’s also sweet in a staging/development environment for  
quickly building new machines. But in a dedicated, static deployment  
environment, I don’t see the value (and I don’t see the scalability  
either) besides possibly being able to easily move to another  
environment (but how often does that really happen in a deployed  
application?)

In your example of splitting mysql into a virtual machine and  
Rails/mongrel in a virtual machine as opposed to running them both on  
a dedicated operating system, you are now running a two full  
operating systems instead of two processes (or groups of processes).

I am sure there are many on this list that disagree 🙂

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [September 25, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/10 "2007-09-25T23:02:31Z")

</div>

I guess the idea would be to make things scale better – so it’s  
easier to move to a multi-server setup if and when. However, I could  
be just getting seduced by the buzz around Xen – hence the post.

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [September 25, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/moving-from-vps-to-dedicated-box-thoughts-re-xen/83903/11 "2007-09-25T23:07:44Z")

</div>

I guess I have to ask, what are your goals with moving to a Xen setup?
