Re: MySQL on virtual hosting

2002-11-25 Thread Brian Reichert
(This is a forward of some private mail with the original poster,
with his permission.)

Date: Sun, 24 Nov 2002 22:59:33 -0500
From: Brian Reichert [EMAIL PROTECTED]
To: Sweethome.co.il Webmaster [EMAIL PROTECTED]
Cc: Brian Reichert [EMAIL PROTECTED]
Subject: Re: MySQL on virtual hosting

On Mon, Nov 25, 2002 at 03:15:00AM +0200, Sweethome.co.il Webmaster wrote:
 The Virtual dedicated systems will need much more resources in real life.
 I can't imagine having 40 MySQL servers running at once when I can't 
 restrain a single one :)

You can constrain a single one, very easily:

  # nice limits -d whatever -m whatever /usr/local/mysql/libexec/mysqld 

Of course, you may not want the jail methodology in general; I'm
not trying to trick you into it, by any means.

If you're virtual hosting, there is the implication that you have
more than one customer on a single system, say, forty of them.

You have at least two options:

- You can let all forty clients (with all of their myriad users,
  sets of users, etc.) talk to a single MySQL daemon.

  You have the ease of no clever engineering to get the to all use
  this daemon, but you now have the task of accounting for their
  usage, and constraining them individually.

- You can give each client their own separate MySQL daemon.

  You have the overhead of each MySQL daemon process consuming some
  OS resources, but now you have the freedom to almost completely
  manage the resources of any one of these daemons.

Plus, you get to deal with the extra hassles of:

- Isolating which clients want binary replication: those logs each
  eat up diskspace, and client's shouldn't unduly impair each other's
  backups.

- What if one client make a request that makes MySQL spin?  That'll
  impair everyone else's ability to process queries.

- What if someone needs the ability to use DATAFILES under MySQL?
  Now you get to juggle who gets read/write permission to the same
  directories that the MySQL does...

If you generalize this work above to other services, such as mail
servers, web servers, etc., you'll see that you're re-solving the
same kind of problem, over and over again.  And when you try to
worry about how much bandwidth each of these services is really
consuming, one tends to migrate to virtual machines as a more
complete, general solution.

No matter how you cut it, you'll still have forty clients (humans,
not mysql clients; each might be dozens of connections) wanting to
interact with your daemon(s).  Either your machine has the gnads
to handle that, or it doesn't.

My desktop is a dual-CPU box, with 1.5G of memory.  An idle instance
of MySQL looks like this:

  natto% ps auxwwe -p 196
  USERPID %CPU %MEM   VSZ  RSS  TT  STAT STARTED  TIME COMMAND
  mysql   196  0.0  1.0 11896 10728 con- S29Oct02 5023:13.08
   /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
   --datadir=/usr/local/mysql/var --user=mysql
   --pid-file=/usr/local/mysql/var/natto.numachi.com.pid

Having forty MySQL daemons, unto itself, doesn't cost the OS very
much at all.

But I _do_ think that for manageability, accounting, 'fairness' to
your other clients, that there's a lot to said for sandboxing them
as completely as possible.  Using a jail gets you all they down to
network traffic.

If nothing else, you can learn who the 'piggy' clients are, and
decide to migrate them to another box, where they have more room...

Have fun. :)

 
  Justin
 

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA Intel architecture: the left-hand path

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL on virtual hosting

2002-11-24 Thread Sweethome.co.il Webmaster
Dear list,

Does any of you guys operate a mysql server in virtual hosting environment?
I need some advice on tuning and restriction based on system resources.

My system is running RH7.2 , on an Intel based server, 2x1Ghz CPU's and 1 
giga of RAM.
I have 2 hd's in raid 1 mode (hardware). I currenly run MySQL 3.23.53

Here are few questions I have in mind, any other advice on keeping this 
system in a
sane state will be appreciated.

1. From the following, what would be the best OS to run MySQL as of today?
FreeBSD, Linux, OpenBSD

2. Is it possible to limit number of connections per user or database?
MySQL can eat pretty much resources, if webmasters write bad code, I need 
to restrict
them or charge extras for the usage as well as to protect the system 
against DOS attacks,
which in this case will need to exploit a bad script which accesses the 
database.
Restricting httpd connections is irrelevant here, so I must be able to 
control MySQL
connections.

3. A lot of ready scripts or novice webmasters know very well how to open a 
connection
but closing it... that's beyond them :) What is a sensible timeout and what 
exactly
is the parameter that can kill these connections?

4. If you run a similar system, what would be the most important parameters 
for load
tuning, and how would you set them?

Thanks for all answers,

		Justin Grindea	
		[EMAIL PROTECTED]







-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Re: MySQL on virtual hosting

2002-11-24 Thread Brian Reichert
On Sun, Nov 24, 2002 at 10:39:43PM +0200, Sweethome.co.il Webmaster wrote:
 Dear list,
 
 Does any of you guys operate a mysql server in virtual hosting environment?
 I need some advice on tuning and restriction based on system resources.

One thing you need to nail down is what the abstraction is: _how_
do you want to implement virtual hosting?

For example, under FreeBSD, you can create a jail(8): a complete
virtual machine tied to an IP address, and you can cram one of your
(human) clients in there, with all of their services.

(Before you worry about consuming all of your public IPs for such
tricks, note that you can run them on private IPs, and use the
kernel's ability to NAT connections in/out of the box to these
virtual machines.)

That technically eats more resources than other virtual hosting
methods, but it most completely isolates a user from the rest of
the system, if you need fine-grained control over how your machine's
getting utilized, this gets you down to the nuts and bolts.

The kernel itself will let you play tricks for traffic shaping, so
you can constrain which of your virtual machines get traffic
'appropriately', and you can packet-filter everything to death, so
that you can prevent them from running services that you don't want.

This is somewhat distinct from the excellent question you ask, and
I'm curious what various people's responses will be...

 Thanks for all answers,
 
   Justin Grindea  
   [EMAIL PROTECTED]

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA Intel architecture: the left-hand path

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php