users@glassfish.java.net

Re: Domains vs. instances, mysql replication in cluster.

From: Shreedhar Ganapathy <Shreedhar.Ganapathy_at_Sun.COM>
Date: Sat, 19 Apr 2008 07:28:02 -0700

Hi Chenin
I will attempt to answer some of your questions. Others will chime in
for the rest.

glassfish_at_javadesktop.org wrote:
> Hello everybody,
> I have lost my job as php/perl/apache admin and now I have got new one as Java EE/glassfish admin.
Hope you find this a rewarding career move. We are here to help with
your success with GlassFish.
> But there is a problem I’m total newbie to glassfish. I have read most of the lengthy manuals Sun provides (with only some understanding) so I’m having more questions then answers and big headache. Glassfish is full of terms which did not existed in apache world.
>
Do send us as many questions as you have and we will help.
> I need a little advice from somebody with experience. Company has Java EE developers which are working on one server and production Enterprise applications deployed on the same server. Server is running Linux FC5, latest glassfish v2, and apache 2.2.x. in developer profile. Now company wants to have some kind of backup.
> So data from one server would be backup to second, and if one fails second can pick up.
> Two servers have been bought, I have already installed FC5 with apache 2.2.2-1.2 (rpm) newest glassfish v2, mysql 5.0.x.
> Developer/production server (leased) will be terminated shortly. We will have more clients shortly and developers have to be separated from production.
> Reading SUN manual I figured out that I should install cluster (on 2 new servers).
> 1) Cluster will take care of backing up all the applications to both servers, so I will not have to backup it manually ?
>
Let me explain a bit. GlassFish bits come with two profiles namely,
developer and cluster profile (if you choose the Sun branded version, it
comes with an additional enterprise profile as well which includes a
high availability database providing 5 9s availability - in addition the
Sun branded versions come with DataDirect drivers). You can convert your
dev profile domain to a cluster profile domain very easily using the
admin console or create a separate cluster profile domain. The cluster
profile domain enables you to create cluster of instances and comes with
in-memory replication for persisting session state to other instances.

Clustering allows you to have redundancy of appserver instances so that
your services are resilient to failures of one or more instances in the
cluster. Over and above that, making your applications
availability-enabled makes your application's user sessions highly
available such that the conversational states are backed up into other
cluster instances in-memory. This backs up your user sessions and not
your domain configuration such that on occurrence of a failure, these
user sessions can be resumed (failed over) in another instance of the
cluster when fronted by a load balancer.
If you were to suffer a disk failure or hardware failure, you should
have backed up your domain configuration at specific points in time when
your deployment was considered stable so that these can be restored when
the problem is resolved. This can be done using the asadmin commands to
backup your domain.xml configuration file so that you can save a copy at
a safe place for restoration purposes (backup and restore are commands
of interest in this case).

> 2) If load balancing module be added do apache 2.2.x I will have failover functionality ?
>
We do have a load balancer plugin that works with Apache, Sun Web Server
and IIS. Yes this will provide you with failover functionality in
addition to things like sticky sessions, configurable routing policies etc.
The document of interest for this purpose is the High Availability Guide
<http://docs.sun.com/app/docs/doc/819-3679>.
> 3) How should I proceed when it comes to separating developer from production, should I created one domain for developers and another for production, or maybe all should be in one domain and developers should work in one instance and production in second instance (each instance would work on both servers in cluster).

Ideally, you should have a dedicated setup that is pristine when it
comes to production so that other systemic factors do not interfere with
production setup. Sharing the machine resources between development and
production would eat up valuable CPU and Memory resources that you would
want to dedicate for your web business to run on.

Hence you are better off separating not only domains but also hardware
between development and production. It is rather easy to setup a dev
profile GF instance in a standalone box. Given that GF is supported on
linux, windows, mac and solaris (both sparc and x86) you have a wide
variety of options to provide your developers to develop their apps in a
standalone environment. However, if its a collaborative env, you may
want to dedicate a separate server for developers.

> I having a problem between full comprehending when to multiply domains and when to multiply instances. Does multiplying instances means using more RAM (because as I understand each instance have separate JVM) and domains would work on the same JVM ? Servers have only 2GB of RAM each.
>
Exactly as alluded to above. You are thinking in the right direction.
You multiply instances in a production environment for either redundancy
reasons (clustering comes in here to help keep a homogeneous app
environment for ease of administration and availability) or for
application isolation (separation of apps into JVMs helps dedicate heap
resources to the app).
The number of instances you can support in a single machine is limited
by the overall system memory. You will need to size and tune your heap
requirements for your production system to determine the number of
instances you can possibly support. For a high traffic deployment, you
will probably need more RAM to support more instances than the 2 GB.
> 4) In each domain different services have different ports 4848, 8080, 7676, etc. Do each service have to have different pots in different instances too ?
For those instances that are on the same machine, yes. GlassFish does
take care of picking up different ports when you create new instances
within the same domain when the instances are on the same machine.
> Clients will not be managing their applications.
>
> 5) Do instances share JDNI or more like in domains they are separated.
> 6) Is it difficult to implement load balancing with apache on Fedora, do I have to patch apache and reinstall it form source ?
> 7) What about mysql database which is used by EAR application. Will cluster take care of replicating it ? When request comes and server A answers, records are added to mysql on server A, next request comes and is being answered by server B and hence record is added to mysql on server B. Will I have two heterogeneous databases ?
>
You don't need to. You can specify JDBC resources (database url using
jdbc protocol, driver, connection pool, etc, for your app to interact
with the DB) at the cluster level such that each instance in the cluster
talks to the same database server.

Hope this is helpful. Do let us know when you are in production and need
to have sustaining and support. Sun offers very reasonable rates for
commercial support of GlassFish. This helps when you need critical fixes
or to address problems on a priority basis.
> Any suggestion to any of my questions will be very appreciated.
> Regards to you all.
> [Message sent by forum member 'chenin' (chenin)]
>
> http://forums.java.net/jive/thread.jspa?messageID=270175
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>