how to set up w/ two app server 'n one database server?

how to set up one site with two app server, and one database - on three 512 linodes?

I went through the library in regards to high available server set up.

the link down below discusses high available web application set up.

http://library.linode.com/linux-ha/ip-f … untu-10.04">http://library.linode.com/linux-ha/ip-failover-heartbeat-pacemaker-drbd-mysql-ubuntu-10.04

However, I would like to separate the database to a third linode. And also, set up the app servers with nginx.

I was thinking of using the above link as a reference, and for database I thought about using stand alone database library link.

http://library.linode.com/databases/mys … 0.04-lucid">http://library.linode.com/databases/mysql/ubuntu-10.04-lucid

It seems it should be pretty straight forward. However, I wonder if there would be write, read issues with data server on mysql.

Any suggestions, constructive criticism welcome.

Thank you.

8 Replies

@superdupler:

the link down below discusses high available web application set up.

http://library.linode.com/linux-ha/ip-f … untu-10.04">http://library.linode.com/linux-ha/ip-failover-heartbeat-pacemaker-drbd-mysql-ubuntu-10.04

That's really more for running mysql on two nodes with failover. What it sounds like you're looking for isn't failover, but instead a load balanced cluster.

you are right. I am more interested in the load balanced set up. Two cloned app nodes and communicates with database node.

I was wondering if there would be any issues as far as read and write on the database… I guess the best set up - two load balancer, two app, and two data servers. However, right now for my purposes it is way overkill.

any suggestions welcome

Isn't that what this is solving?

http://www.linode.com/nodebalancers/

See the 3rd example here:

http://library.linode.com/linode-platfo … ncer-howto">http://library.linode.com/linode-platform/nodebalancer-howto

Two app servers using one database server is no problem, from MySQL's perspective. In fact, the odds are good your application already makes multiple connections to MySQL. Read-after-write consistency issues start to come into play when you have multiple database servers, but that's an entirely different ball of fish.

Thank you for those links. I really appreciate it.

What is the maximum amount of app servers possible on this 'node balancer' set up?

Lets say… when the site gets a high load, would you be able to add 5 app servers? Or even be able to go up to 10 app servers? And all along use only one data server.

I believe there's no pre-defined limit for the number of application servers you can have behind a NodeBalancer. However, there's a default limit of 5,000 concurrent connections, so having more than 5,000 application servers would not yield any additional benefit without upgrading your NodeBalancer plan.

MySQL does have a limit to how many connections it can handle simultaneously. Each additional connection uses a little more memory, so it is a tunable parameter.

There's also a practical limit to how much stuff a single MySQL server can do simultaneously: if you're using MyISAM and have a write-heavy database, you're going to be lucky to get one application server working well. But, with InnoDB, few writes, well-designed indexes and queries, and perhaps a layer of caching to take care of the most-common data needs, it'll hum along nicely.

so linode caps out on 5,000 concurrent connections?

> with InnoDB, few writes, well-designed indexes and queries, and perhaps a layer of caching to take care of the most-common data needs

what do you mean by well-designed indexes and queries?

does 'a layer of caching' means caching queries?

@superdupler:

so linode caps out on 5,000 concurrent connections?

The basic NodeBalancer plan caps out at 5,000 concurrent connections. However, there's no hard connection limit on a Linode, but the kernel and your applications might have limits.

> what do you mean by well-designed indexes and queries?

You typically query a database using SQL, and how the query is designed can drastically change the amount of time it takes to run. Most SQL databases also support indexes, which are somewhat like the index in the back of a book: instead of scanning through an entire book looking for the word 'gazpacho', an index tells the database that the word 'gazpacho' appears in a specific place.

Query design and indexing and SQL server tuning are an art, and they are quite application-specific. They're also the sort of thing that you don't want to optimize prematurely: it doesn't make much sense to shave 50 milliseconds off of a query that, as it turns out, only happens twice a day.

> does 'a layer of caching' means caching queries?

Or the results from them, at least. If you have queries like SELECT content FROM articles WHERE slug = 'slug-futures-skyrocket', you can save your database some work by using something like memcached to store the results for quick retrieval later on. Most decent frameworks handle this for you; there's a few rather interesting problems.

Another thing I forgot to mention originally: if you have two application servers and one of them dies, you're OK, because you have a second one. If you have one database server and it dies, you're SOL until it comes back. So, be aware that it's not a high-availability setup, just a load-balancing one. :-)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct