Moving from VPS to dedicated box. Thoughts re Xen?

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

On Jan 30, 9:57 pm, “ChrisT” [email protected] wrote:

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

Debian decided to go with OpenVZ [ 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 :wink:

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-
store ]

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

On 1/30/07, ChrisT [email protected] 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?

:slight_smile:

  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. :slight_smile:


– Tom M.

stoyan wrote:

bad option at all :wink:

Stoyan
Thanks for this. V. useful.
Cheers
Chris

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. :slight_smile:

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

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-
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

Tom,

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

Only…it’s not. :slight_smile: 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 :slight_smile:


Aníbal Rojas

On 1/31/07, Aníbal [email protected] 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-
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. :slight_smile: 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.

That is my opinion of Xen :slight_smile: 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 :slight_smile:

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.

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