What is Weblogic server?
A weblogic server is a instance of java process executing in a JVM.Weblogic server is a software application that runs as a middle tire between back-end database and related applications and browser based thin clients.Two Type of servers:
1. Administration server.
2. Managed server.
What is a Admin Server?
Every domain have one and only one admin server.
It is the central point of control for the webLogic domain.
It runs Weblogic admin console.
Admin server stores the master copy of the domain config.
Usually we can deploy applications on AdminServer/ManagedServers/Clusters But for Production environments, it is Not recommend to hosting application logic or resources on the Administration Server.We can deploy applications on admin server but it is not recommended.
What is a Managed server?
A domain can have zero or more managed servers.
All the applications are hosted in managed servers only.
Admin server stores the master copy of the domain config. Each Managed server stores local copy of domain config.Managed server contacts the admin server while starting. So, to do any changes, we need to contact Admin server.Admin server will push those changes to Managed servers. We can start the managed server if admin server failed. But we cant do any changes in managed server if admin is failed(Stopped).
admin vs managed:
Managed Servers are similar to the Administration Servers, except few differences. Like Managed Servers will not have Administration Console Application (consoleapp) deployed in it.
Each Managed Server is independent of all other Managed Servers in the domain. Managed Servers can be part of Clusters to work together as a Unit. We can have one or more than one Managed Servers in a domain according to our requirement. The Managed Servers can reside inside the Physical box of AdminServer or they can run on a Separate Physical Box as well.
What Happens if the Administration Server Fails?
The failure of an Administration Server for a domain does not affect the operation of Managed Servers in the domain.If an Administration Server stops running while the Managed Servers in the domain continue to run, each Managed Server periodically attempts to reconnect to the Administration Server.Also, you can start a Managed Server even if the Administration Server is not running.
Is it possible to start Managed server without Admin server or Why availability of Admin server is important?
Oh yes...managed servers are individual entities and can serve the request on their own but it will depend on actually how they were configured?
While building the WebLogic environment the option "Managed Server Independence Enabled" was not checked. I am not sure, what could be the reason for it.
It is found under: Environment > Servers > Configuration > Tuning > Advanced
If the "Managed Server Independence Enabled" option is enabled, Admin server will push the config.xml to all the managed servers as msi-config.xml.
When a Managed Server starts, it tries to contact the Administration Server to retrieve its configuration information.If a Managed Server cannot connect to the Administration Server during startup, it can retrieve its configuration by reading configuration (msi-config.xml)
and security (boot.properties) files directly. A Managed Server that starts in this way is running in Managed Server Independence (MSI) mode.
config.xml:
It is the most important part of weblogic server. In a distributed environment, the config.xml file only resides on admin server and gets created automatically in the domain folder as soon as the server starts for the first time. As the name suggests, it contains the configuration of the domain like entries of the servers, clusters, data-sources etc.
The passwords in config.xml file are encrypted using DES algorithm and vary from domain to domain. Said that, every domain will have SerializedSystemIni.dat, which works as a key to encrypt and decrypt any element.
Do not worry, if SerializedSystemIni.dat is not present in the domain folder as it gets created automatically as soon as you start the server.
config.xml is the central configuration repository for a domain. every resource you have configured from admin console or by command line or by any other tool registered under this file.
Location: $DOMAIN_HOME/config/config.xml
What is a Domain?
Domain is logical grouping of resources and services and consist of Administration Server, Managed Server and cluster. There can only be one administration Server in domain and zero to N Managed Server.
What is a Machine in Weblogic server?
A computer that hosts the WL server instances.Used by node manager to restart a failed managed server.
What is a Node Manager?
-Node manager is a utility or process running on a physical server that enables starting, stopping,suspending or restarting admin and managed server remotely.
Node Manager is utility in Oracle WebLogic Server to start , stop, restart Managed Server or Administration Server remotely.
-It is not associated with a domain, though can start any server that reside on same physical server.
-it is required if we use Admin console to start servers.
Node Manager is optional component in WebLogic Server but it is mandatory if you want to start Managed Server from Console (other option is to start Managed Server from command line)
Node Manager is optional component in WebLogic Server but it is mandatory if you want to start Managed Server from Console (other option is to start Managed Server from command line)
There is two types of NM,
1. java-based:(runs under JVM) (more secure)
2. Script based:(not available on windows)
1). Java Based Nodemanager: This can be used in Windiows as well as UNIX based Operating systems. Java Based Node Manager is not supported on Open VMS, OS/390, AS400, UnixWare, or Tru64 UNIX.
2). Script Based Nodemanager: This nodemanager can be used in UNIX based operating systems. The advantage of the script-based Node Manager is that it can remotely manage servers over a network that has been configured to use SSH.
Why We Need Nodemanagers?
1). It can Start, Shut Down, and Restart an Administration Server which has assigned a Machine.
2). It can Start, Shut Down, and Restart an Managed Server which has assigned a Machine.
3). It can Restart Administration and Managed Servers. (Crash Recovery of Servers is an Interesting feature)
4). It can be used to Monitor Servers and View Log Data
How to start Node Manager ?
$WL_HOME\server\bin\startNodeManager.sh
To Stop Node Manager
In Unix/Linux, kill the process -
kill -9 `ps -ef | grep -i nodemanager.javahome | grep -v grep | awk {'print $2'} | head -1`
Node Manager Log Files
$WL_HOME/common/nodemanager/nodemanager.log
Why node manager is required?
A Node Manager process is not associated with a specific WebLogic domain but with a machine.
You can use the same Node Manager process to control server instances in any WebLogic Server domain, as long as the server instances reside on the same machine as the Node Manager process. Node Manager must run on each computer that hosts WebLogic Server instances. whether Administration Server or Managed Server that you want to control with Node Manager.
Node Manager Log Files
$WL_HOME/common/nodemanager/nodemanager.log
Important configuration file for node manager:
$WL_HOME/common/nodemanager/nodemanager.properties- used by java based node manager. This file is created on first time start of nodemanager (startNodeManager.sh)
$WL_HOME/common/nodemanager/nodemanager.domains - contains mappings between the names of domains managed by Node Manager and their corresponding directories.
entry like
base_domain=D:\Oracle\Middleware\user_projects\domains\base_domain
soa_domain=D:\Oracle\Middleware\user_projects\domains\soa_domain
$WL_HOME/common/nodemanager/nm_data.properties- This file stores the encryption data the Node Manager uses as asymmetric encryption key. This file is created on first time start of nodemanager (startNodeManager.sh)
$DOMAIN_HOME/config/nodemanager/nm_password.properties- This file stores the Node Manager username and password used by Admin Server to connect to Node Manager.
What are the Default port number for admin, node manager and ssl ?
Default multicast address? Multicast range?
Default port no for admin :7001
ssl: 7002
node manager: 5556
Default multicast address :239.192.0.0
range 224.0.0.0 to 239.255.255.255
Development Mode
The default JDK for development domain is Sun Hotspot
You can use the demo certificates for SSL
Auto deployment is enabled
Server instances rotate their log files on startup
Admin Server uses an automatically created boot.properties during startup
The default maximum capacity for JDBC Datasource is 15
The debugFlag which is used to start the WebLogic Workshop Debugger is enabled
Production Mode
The default JDK for production domain is JRockit
If you use the demo certificates for SSL a warning is displayed
Auto deployment is disabled
Server instances rotate their log files when it reaches 5MB
Admin Server prompts for username and password during startup
The default maximum capacity for JDBC Datasource is 25
The debugFlag which is used to start the WebLogic Workshop Debugger is disabled
Weblogic Boot Properties
Using boot.properties, you can control the server startup without passing the username and password.
1. Create a boot.properties file.
Create a plain text file called boot.properties with the following content:
username=weblogic
password=weblogic01
2. Copy the boot.properties to the following location:
/usr/local/weblogic10/user_projects/domains/devdomain/servers/managedserver1/security
/u01/app/middleware/user_projects/domains/ba_bi_uat/servers/bi_server1/security
/u01/app/middleware/user_projects/domains/ba_bi_uat/config
[user@abc config]$ ls -lrt config.xml
-rw-r----- 1 user dba 38119 Oct 25 2016 config.xml
[user@abc config]$
What is a Cluster?
Two or more managed server becomes or forms the cluster in a domain and cluster handle the load balancing across the cluster.
Group of WebLogic Managed Server Instances that work together to provide high availability and scalability for applications is called cluster. WebLogic Servers with in cluster can run on same machine or different machines. These are also called as managed Server cluster.All the servers in a cluster must be in same domain. All servers in a cluster must be same version level, though they can run on different machines.
There are two method of clustering Horizontal and Vertical.
Horizontal clustering :involves running multiple Java application servers that are run on two or more separate physical machines. Horizontal scaling is more reliable than vertical scaling, since there are multiple machines involved in the cluster environment, as compared to only one machine.
vartical Clustering: however, consists of multiple java applications servers on a single physical machine. with vertical scaling, the machine's processing power, cpu usage, JVM heap memory configurations are the main factors in deciding how many servers instances should be run on one machine.
Difference between horizontal and vertical cluster?
Horizontal clustering involves running multiple Java application servers that are run on two or more separate physical machines.
Vertical clustering, however, consists of multiple Java application servers on a single physical machine.
How does Cluster Communication Happen?
Members of the Cluster communicate over the Cluster Multicast IP and Port by sending periodic heart beat messages.
How do stubs work in a WebLogic Server cluster?
Clients that connect to a WebLogic Server cluster and look up a clustered object obtain a replica-aware stub for the object. This stub contains the list of available server instances that host implementations of the object. The stub also contains the load balancing logic for distributing the load among its host servers.
Stubs perform the process of removing the failed instance from the list whenever there is a failure. The stub usually makes use of DNS for finding the running server and also for obtaining the list of the instances that are currently available with the application.
What are the States of the Weblogic Server?
There are 9 states of server which are given below
Shutdown
Starting
Standby
Resuming
Running
Suspending
Shutting down
Failed
Unknown
What is Thread?
A thread is a single sequential flow of control within a program.
What is Thread dump?
Thread Dump is a textual dump of all active threads and monitors of Java apps running in a Virtual Machine.
A Java thread dump is a way of finding out what every thread in the JVM is doing at a particular point in time. This is especially useful if your Java application sometimes seems to hang when running under load, as an analysis of the dump will show where the threads are stuck.
We take thread dump as below:
1) Linux : kill -3 <ps_id>
2) Windows (console mode) : crtl+break
3) Windows (service) : beasvc -dump -svcname:mydomain_myserver.
examples when we take thread dump:
1. when server is hang Position, i.e. that time server will not respond to coming requests.
2. While sever is taking more time to restart
3. When we are Getting exception like “java.lang.OutOfMemoryException”
4. Process running out of File descriptors. Server cannot accept further requests because sockets cannot be created
5. Infinite Looping in the code
What is Stuck Thread?
A Stuck Thread is a thread which is processing a request for more than maximum time that you configured in admin console.
How to deal with Stuck Thread?
Take multiple thread dumps immediately.
Review thread dumps or from console (managed server > monitoring > threads).
See how many threads got stuck?
If the stuck thread count is increasing or constant?
If constant then if got stuck on same area (application code etc ) or at different places ?
If getting increase then there would be some serious problem and you have to do a quick health check of you application server, database and other integrated technologies wherever your application reaching like ldap server for authentication, some other API’s or web services etc, and in parallel review thread dumps for stuck threads and share same with your developers to analyze quickly.
If you have one, two or few constant stuck threads and it’s not increasing then you can monitor it for some more time to check if they get clear or not, if not then to clear them you have only option to restart your managed server(s), and its better to restart and clear them before they make further any impact.
What is Hogging Thread?
Hogging threads are candidates for stuck threads.
Threads that “might” get stuck. These threads will be declared “stuck” after StuckThreadMaxTimeout seconds which usually is 600secs.
If the thread gets released by the request before this timeout, it wont be called hogging thread anymore and will be released to the thread pool.
Hogging Threads that have taken the too much time and we can assume that they are never going to come back.
Hogging threads help us take some decisions, lets say many threads are hogging, we may take a decision to create new threads for next cycle.
A hogging thread is a thread which is taking more than usual time to complete the request and can be declared as Stuck .
How Weblogic determine a thread to declare as hogging?
A thread declared as Stuck if it runs over 600 secs (default configuration which you can increase or decrease from admin console).
There is an internal WebLogic polar which runs every 2 secs (by default 2 secs and can be alter)
It checks for the number of requests completed in last two minutes
Then it check how much times each took to complete
Then it takes the average time of all completed request (completed in last 2 sec)
Then multiply average time with 7, and the value came consider as “usual time to complete the request”
Now weblogic check each current executed thread in last 2 secs and compare with above average time, if for any of the thread it’s above this value then that thread will declare as Hogged thread.
For example –
At a particular moment, total number of completed requests in last two seconds – 4
Total time took by all 4 requests – 16 secs
Req1 took – 5 secs, Req2 took – 3 secs, Req3 took – 7 secs, Req4 took – 1 sec
Average time = 16/4 = 4 secs
7*4 = 28 secs
Now weblogic check all executed threads to see which taking more than 28 secs, if any then that thread(s) declared as Hogged Thread.
Only the thing you can change with respect to hogging threads configuration is Polar time (Stuck Thread Timer Interval parameter)which is 2 secs by default. You can change this polar value to some different value like 4 secs if you want polar to run in every 4 secs instead of 2 secs.
Version:
1) Go to Fusion middleware Home directory with run or patch edition
cd $MW_HOME
grep -I version registry.xml
2) we can check the version from console also
Login to http://<server_name>:<port>/console
Weblogic version is there in the bottom
Data source:
A data source is an object that enables a Java Database Connectivity (JDBC) client to obtain a database connection. The data source has a collection of database connections called a connection pool. An application can request a connection from the data source, use the connection to access the database, and then close the connection. Rather than actually close the connection, however, the data source places it back in the connection pool to be used again. Data sources can be created as part of the configuration of an instance of WebLogic Server. When that server comes up, (or the data source is deployed), the server creates database connections to fill the connection pool of its data source.