Tuesday, 18 November 2014

Tuning JRockit

Tuning the Heap Size:
  • A large heap decreases the garbage collection frequency but may take slightly longer to garbage collect.
  • Typically a heap should be at least twice the size of the live objects in the heap.
  • Should set the heap as large as the PHYSICAL memory in your system will allow, as long as it doesn’t cause paging.
  • -Xms:, which sets the initial and minimum heap size.
  • -Xmx:, which sets the maximum heap size.
  • Set the initial/minimum heap size (-Xms) to the same value as the maximum heap size (-Xmx).
Tuning the Garbage Collection
  • JRockit offers three garbage collection modes and a number of static garbage collection strategies. You can tune the garbage collection to suit your application’s needs.
  • -XgcPrio:throughput: Defines that the garbage collection should be optimized for application throughput. This is the default garbage collection mode.
  • -XgcPrio:pausetime : Defines that the garbage collection should be optimized for short garbage collection pauses.
  • -XgcPrio:deterministic {Only with JRockit Real-Time}: Defines that GC should be optimized for very short and deterministic garbage collection pauses.
Tuning the Pause Target
  • This parameter is used to tune JVMs which host ‘time critical applications’ (Ex: A banking application  that normally take 100 ms to complete and times out after 400 ms, cannot afford a GC pause time of 500ms)
  • The pause time mode uses a pause target for optimizing the pause times; pause target should be as high as your application can tolerate
  • This parameter is coupled and used with ‘-XgcPrio:pausetime’ (ex: java -XgcPrio:pausetime -XpauseTarget:300ms weblogic.Server); default ‘pauseTarget’ is not specified is 500ms


# Below given parameters should not be changes until you
feel a real need to tune your Weblogic server; incorrect
 tuning may lead to uneven performance degradation.


Tuning Compaction

  • Whenever GC(old collection) runs it defragments the heap, making object allocation easier for the JVM this process is called heap compaction; compaction may lead to long pauses in GC because it takes up the CPU time to arrange and defragment the heap
  • -XXcompactRatio:centage> : this specifies the percentage of heap which will be defragmented when GC runs;  a good value for the compact ratio is usually between 1 and 20; a too low value can also invite trouble as it slows down defragmentation and increases the amount of dark matter(“Dark matter” is wasted heap memory and fragments the heap)
  • -XXcompactSetLimit:<references> : When compaction has moved objects, the references to these objects must be updated. JVM has to do this before threads have access to those memory references; this parameter defines how many references GC can compact within the compaction area (Ex: java -XXcompactSetLimit:20000 MyApplication)
Tuning the TLA (Thread Local Area)
  • It is the chunk of memory reserved in the heap for a thread for its exclusive use.
  • When this TLA gets filled up we see the ‘java.lang.OutOfMemoryError: nativeGetNewTLA’, to fix this we can tune the ‘-XXtlaSize:min=e>,preferred=’ parameter increase the TLA (Ex: -XXtlasize:min=8k,preferred=512k)
  • Increasing the TLA size is beneficial for multi threaded applications; however increasing it too much may result in more fragmentation and more frequent garbage collections.

Basic Unix commands


DOS Command
Unix Command
Descriptions
CD
cd
Change directory
CHKDSK
du
Disk usage
CLS
clear
Clear the current screen
COPY
cp
Copying files
DEL
rm
Removing files or directories
DIR
ls
File listing of directories
MD
mkdir
Create a directory
MORE
more
Type out a file with paging
PRINT
lpr
Print out a file
RD
rmdir
Remove a directory
RENAME
mv
Moving files around
TYPE
cat
Type out files

Unix Command
Descriptions
rm file
Remove a file
rm file1 file2 …
Remove a number of files
rm -r  directory
Remove a directory include the sub-directory
rmdir directory
Remove a directory


Unix Command
Descriptions
man cp
Display on-line manual for the "cp" command
man -k keyword
Display manual help file related to the keyword
passwd
Change your login password
pwd
Display the path name of where you are
uptime
Tell you how long the machine has been up and running
users
Tell you who is logging in
who
Tell you who is logging-in in detail
w
Tell you who is logging in and doing what!
whoami
Show you the owner of this account
finger user
Find out the personal information of a user
finger name
Try to find the person's info. by his/her name
finger email-address
Try to find the person's info across the network
write user
Write a message on somebody's screen
talk user
Talk to the person logging in the same system with you
talk email-address
Talk to somebody logging in the network
date
Display today's time and date
cal year
Display the calendar of the specified year (e.g. 1997)

Offline WLST script to create domain in WLS



WLST SCRIPT:-


  1. # This is an Offline  WLST script to create a WLS 12.1.3.0 (Oracle Weblogic Server 12c) Domain

  2. # Domain consists of:
  3. # 1. Admin Server
  4. # 2. Two Managed Servers
  5. # 3. A Cluster with Two Managed Server
  6. # 4. An application deployed to the cluster
  7. # Read a domain template
  8. print('ReadingTemplate - D:/Oracle/12cR1/one/wlserver_12.1.3/common/templates/domains/wls.jar')
  9. readTemplate('D:/Oracle/12cR1/one/wlserver_12.1.3/common/templates/domains/wls.jar')
  10. # Admin Server
  11. print('Creating Server - Admin Server')
  12. cd('Servers/AdminServer')
  13. set('ListenAddress','localhost')
  14. set('ListenPort', 7001)
  15. create('AdminServer','SSL')
  16. cd('SSL/AdminServer')
  17. set('Enabled', 'True')
  18. set('ListenPort', 7002)
  19. # Security
  20. print('Creating Password')
  21. cd('/')
  22. cd('Security/base_domain/User/weblogic')
  23. cmo.setPassword('welcome1')
  24. # Start Up
  25. print('Setting StartUp Options')
  26. setOption('CreateStartMenu', 'false')
  27. setOption('ServerStartMode', 'dev')
  28. setOption('JavaHome','D:/Oracle/11gR1/one/jrockit_170_75_R27.6.2-20')
  29. setOption('OverwriteDomain', 'true')
  30. # Create Domain to File System
  31. print('Writing Domain To File System')
  32. writeDomain('D:/Oracle/12cR1/one/user_projects/domains/OfflineDomain_WLST')
  33. closeTemplate()
  34. # Read the Created Domain
  35. print('Reading the Domain from In Offline Mode')
  36. readDomain('D:/Oracle/12cR1/one/user_projects/domains/OfflineDomain_WLST')
  37. # Creating Managed Servers
  38. print('Creating Server - MS1 on Port # 8001')
  39. cd('/')
  40. create('MS1', 'Server')
  41. cd('Server/MS1')
  42. set('ListenPort', 8001)
  43. set('ListenAddress', 'localhost')
  44. print('Creating Server - MS2 on Port # 8011')
  45. cd('/')
  46. create('MS2', 'Server')
  47. cd('Server/MS2')
  48. set('ListenPort', 8011)
  49. set('ListenAddress', 'localhost')
  50. # Create and configure a cluster and assign the Managed Servers to that cluster.
  51. print('Creating Cluster - WLSTCluster and adding MS1, MS2')
  52. cd('/')
  53. create('WLSTCluster', 'Cluster')
  54. assign('Server', 'MS1,MS2','Cluster','WLSTCluster')
  55. cd('Cluster/WLSTCluster')
  56. set('MulticastAddress', '237.0.0.101')
  57. set('MulticastPort', 8050)
  58. set('WeblogicPluginEnabled', 'true')
  59. #Create a new application deployment - Deployment Archive : "d:/Lou/VersionInfo.war"
  60. print('Deploying application named VersionInfo from d:\Lou\VersionInfo.war')
  61. cd('/')
  62. myApp=create('VersionInfo', 'AppDeployment')
  63. myApp.setSourcePath('d:/Lou/VersionInfo.war')
  64. assign('AppDeployment', 'VersionInfo', 'Target', 'WLSTCluster')
  65. # updating the changes
  66. print('Finalizing the changes')
  67. updateDomain()
  68. closeDomain()
  69. # Exiting
  70. print('Exiting...')
  71. exit()
  72. # Code written by:
  73. # Krushna Sunkara
---