Title: Session No' Presentation Title
1EAS301 - EAServer Tips and Tricks
Scott McReynolds OEM/Solutions Engineering
Manager e-Business scottmc_at_sybase.com
2Agenda
- Tuning Tricks
- Design Tricks
- Troubleshooting Tricks
3OS Settings
- Some settings must be made on the OS to improve
performance. - Avoid "connection refused" errors by clients
- ndd command deals with tcp/ip internet protocals
- ndd -get /dev/tcp tcp_conn_req_max_q
- ndd -get /dev/tcp tcp_conn_req_max_q0
- Should be set to at least 1024
- ndd -set /dev/tcp tcp_conn_req_max_q 1024
- ndd -set /dev/tcp tcp_conn_req_max_q0 1024
- No reboot is required after setting the command
4OS Settings
- Increase the number of allowable open files.
- Can cause refused connections or increased wait
time. - Edit the /etc/system file
- set rlim_fd_cur4096
- set rlim_fd_max4096
- Reboot is required
5Flow Control
- Flow control means limiting the number of threads
that can do real works at the same time. - Handler threads are competing with each other for
resources and creating traffic jams and
eventually the response time of each thread
degrades to an unaccepted degree.
V.S.
6Flow Control
- com.sybase.jaguar.server.flowcontrol.http
- Indicate if HTTP requests are subjected to flow
control - com.sybase.jaguar.server.flowcontrol.maxexethreads
- A positive integer, to indicate the maximum
number of concurrent execution threads allowed at
one time. - com.sybase.jaugar.server.flowcontrol.iiop
- Indicate if IIOP requests are subjected to flow
control - NOTE Deadlock situation under some client
applications when IIOP is under flow control.
7Logging
- Log4J Integration
- The built-in EAS subsystem
- The ability to configure log levels
- Messages below a specified level of severity are
discarded. - Support for different logging configurations in
the debug and production servers. - Optional archiving and compression of previous
log file versions. - More control over message formatting.
8Lightweight EJB Container
- Improves Performance for EJB -gt EJB
Communications. - Default for Server.
- com.sybase.jaguar.server.lwc
- Component level Property.
- com.sybase.jaguar.component.lwc
- EAServer activates the lightweight container for
EJB-to-EJB calls as long as all of the following
are true - The LWC is enabled for the server and the called
(target) component. - The calling (source) component uses an EJB
reference or EJB local reference to make the
call. - The LWC is compatible with the transaction and
security properties of the calling (source) and
called (target) components. - The LWC cannot be forced to activate.
- Significant performance improvement with
"Required" or "Requires New". - Object references cannot be marshalled.
9Connection Cache Settings
- com.sybase.jaguar.conncache.poolsize.max
- maximum number of connections kept open in the
cache. - com.sybase.jaguar.conncache.poolsize.min
- minimum number of connections kept open in the
cache. - com.sybase.jaguar.conncache.poolmanager.maxconnect
ions - connections that can be allocated before
determining whether to wait for a connection. - A value of 0 indicates that new connections
should be opened whenever they are required. - If the number of open connections is greater than
the value of poolsize.max the excess connections
are not returned to the pool. - com.sybase.jaguar.conncache.poolmanager.wait
- Specifies whether to wait for a connection.
10EJB CMP Cache
- Drivers to improve overall performance of CMP
EJBs - Allowing updates to be deferred to the end of
each transaction and sent together as a command
batch.. - Reducing network round trips between the database
server and EAServer. - Supports automatic creation of semi-temporary
stored procedures. - Sybase Driver com.sybase.ejb.cmp.SybaseDriver
- Oracle Driver com.sybase.ejb.cmp.OracleDriver
- Lots of new Parms.. Check the documentation
11Purpose of Caching
- EJB.
- Improve performance by avoiding the loading of
instance state at the start of each transaction. - Servlet/JSP.
- Allows Servlet and JSP content to be cached by
the server. - Drastically improves speed at which content is
served to the user. - Initial benchmarks show over 60 X increase.
- Caching is based on 7 different key parameters
and a timeout parameter. - The response data (a byte array) and all the
response headers are saved in the cache. - The cache is not persistent, and is not
synchronized among servers in a cluster.
12Benefits of Object Cache
- For update transactions, may be able to avoid any
SQL select statements, while still having to
execute a SQL update statement. - For read-only transactions, may be able to
entirely avoid the execution of SQL statements. - For CMP entity finder methods that return
collections, may be able to run one query instead
of N1 queries for finders returning a collection
containing N entities.
13Performance Gain Depends On
- Frequency of re-use of objects with same
key,e.g. how often does a new transaction use
the same entity as a previous transaction for
which an entry is still present in the object
cache. - Ratio of update to read-only transactions.
- Size of data set (e.g. database table).
- Size of object cache.
- Configured timeout for cache entries.
14Cache Options/Simple Cache
- Implement Java side Servlet cache which will
cache outputs of Servlet/JSP in java core memory. - Fast response for Servlets or JSPs that the
output will not be changed during the timeout
period. - com.sybase.jaguar.servlet.javacache.enabled
- Default is false
- com.sybase.jaguar.servlet.javacache.session
- Keep - If request includes session id, we'll try
to get the session. - Create - If request includes session, we'll try
to get the session. - No - Do not check or return "Set-Cookie" session
header.
15Cache Options/Simple Caching - Continued
- com.sybase.jaguar.sevlet.javacache.maxsize
- The value is the number of K bytes indicates the
limit of the content size. - Default is 8k
- Limit 100
- com.sybase.jaguar.sevlet.javacache.timeout
- The timeout in seconds.
- Default 60
- lt 0 means never expired.
16Cache Options/Cache Architecture
- Interface CtsComponentsObjectCache (basic
operations find, get, put, remove) - Component CtsComponents/ObjectCache (built-in
implementation) - Configurable each entity/stateful component can
have its own cache configuration. Caching is
disabled by default. - Pluggable - partners and end users can write
their own cache implementations (components).
17Cache Options / ObjectCache Component
- Built-in component is implemented in C for
- two reasons
- Maximum performance
- Cache data is not visible to Java VM garbage
collector. This allows extremely large
caches,e.g. 500Mb. - Cache implementations must use C or Java
(requires the use of the Bind Object option).
18Role of Dispatcher
- Before xxxFindByPrimaryKey converts instance key
to binary form and calls find on cache. - Before xxxLoad converts instance key to binary
form and calls get on cache. - After xxxCreate/xxxStore converts instance key
state to binary form and calls put on cache. - After xxxRemove converts instance key to binary
form and calls remove on cache.
19Transaction Consistency (for update transactions)
- Cache put and remove calls are only made
after successful transaction completion, i.e. we
never place uncommitted data in the cache. - Should be combined with optimistic concurrency
control (OCC) - the default behaviour with
Automatic Persistent State (CMP).
20Transaction Consistency (for read-only
transactions)
- Stale cache entries can cause problems for
read-only transactions, which have no way to
detect that they have used stale data. This can
be handled - By configuring Cache Timeout.
- By configuring Cache Synchronization.
- By arranging to be notified when updates are made
to the underlying data, e.g. database trigger
notifies cache to flush one or more entries.
21Component Settings
- CMP Performance Settings
- When to load data from the database within a
transaction - com.sybase.jaguar.component.load
- By default beforeInvoke, beforeRemove
- When to store data to the database within a
transaction - com.sybase.jaguar.component.store
- By default afterCreate, afterInvoke
22Component Settings/CMP Settings (Continued)
- To reduce load and stores
- com.sybase.jaguar.component.load
- Change to afterBegin to do loads only after a
begin transaction - com.sybase.jaguar.component.store
- Change to beforeComplete to only do stores before
the completion of a transaction
23Component Settings/EJB Settings
- Use local interface instead of remote interface
- Causes less marshalling
- Parms are passed by reference instead of by copy
24Component Settings/PB Components
- Deployment of PB Components creates
- JAGUAR Repository Component ltP
ackage Namegt ltComponent Namegt.props
ltComponent Namegt Cltngt
ltone or more PBDs implementing comp
onentgt
25Component Settings/PB Components
- Sharing Class Group Loaders
- com.sybase.jaguar.component.pb.librarylist
- Has a value of PBD1.PBDPBD2.PBDPBD3.PBD...
- A unique instance of a class group loader is
assigned to each distinct occurrence of a library
list - The default will cause a unique library list for
each PB component deployed because of the
substitution that occurs
26Component Settings/PB Components
- Sharing class group loaders - solution.
- Include all PBLs containing the NVOs that are
sharing resources in a single, combined library
list. - Deploy each component as you normally just ensure
you use the same deployment options in terms of
PBL consolidation. - Use jaguar manager to modify the
com.Sybase.Jaguar.Component.pb.librarylist
property in the properties file of each component
to be the exact same list by referencing a fully
qualified path to the constituent PBDs. - Refresh the components.
- Backup the changes to the components' properties
files.
27Web Application Settings
- Increase Listener settings
- com.sybase.jaguar.listener.http.conn.maxrequests
- It must be greater than the number of iterations
of each client will run avoid unnecessary close
of socket key when doing stress testing. - If set to low can cause invalid server response
- JSP Settings
- Do not check if the JSP is outdated or not
- com.sybase.jaguar.webapplication.jspc-interval-1
28Web Application Settings
- Turn off HTTP logging
- Done via Jaguar Manager
- Insure the number of threads is set correctly
- Do not check if the JSP is outdated or not
- com.sybase.jaguar.server.http.maxthreads
- com.sybase.jaguar.server.maxconnections
- com.sybase.jaguar.server.maxthreads
29Web Application Settings
- Turn on HTTP cache
- Done via Jaguar Manager
- com.sybase.jaguar.server.http.cache.debug
- com.sybase.jaguar.server.http.cache.enable
- com.sybase.jaguar.server.http.cache.exclude-files
- com.sybase.jaguar.server.http.cache.size
- com.sybase.jaguar.server.http.cache.timeout
- com.sybase.jaguar.server.http.cache.webapps.exclud
e-files - Saves static HTML information
- Pages
- Images
- Etc.
30Partial page caching
- Partial page caching allows you to cache parts of
a response. - Supported by a tag library for use in JSPs, and a
public API for use in servlets. - Uses CacehTags.jar
- lt_at_ taglib uri"http//www.sybase.com/EAServer/cac
hetags.tld" prefix"ct"gt - To cache a portion of a page, surround it with
this tag, as in - ltctcache attributesgt
- ... page content ...
- lt/ctcachegt
- The API is implemented by class CacheManager
- Create
- Retrieve
- Places Data in Cache
- Flush
31Agenda
- Tuning Tricks
- Design Tricks
- Troubleshooting Tricks
32Design Issues
- No pooling objects
- Programmatic pooling is available for objects
implementing the COM ObjectControl or EJB 0.4
ServerBean interface. - canBePooled for PB/COM
- canReuse for CORBA objects
- Called if the pooled flag is not set.
- Declarative pooling is available via Pooling
check-box in Component Properties. - Stateful components cannot be pooled
- A min and max pooling value can be set to help
manage memory.
33Design Issues
- Develop small components
- one ancestor object gets inherited and code
specific logic - Most components can be developed with two pbls
- Keep library list small.
- Publish one component per application.
- This keeps the size of the component down
- Create all datastores in the components
constructor event and initialize the dataobject.
34Design Issues
- Dont over design too many inter-component calls
kill performance and take up too many resources. - Only use PB components for shared components if
it is not called from other components or if its
meant to synchronize the calls. - Dont use PB components as services if the
component will run in a loop.
35Design Issues
- Single Threading of objects
- Concurrency not enabled
- More copies needed then necessary
- In PB, the PBD is locked during execution
- SQL Issues
- Using Large ResultsSets
- Take lots of memory possibility 2 copies of used
with TabularResults.ResultSet - Conversion could require processing and looping
of entire ResultSet
36Design Issues
- Untuned SQL
- Slow Performance of the SQL within the DB
- Mis-use of the connection caches
- Not returning connections to the cache
- Causes more JCM_FORCE connections
- Use of JCM Wait
- Makes client think the server is hung
- Lots of I/O to the log
- Provide a switch that will turn debugging on/off
- Write to the log via the MessageService
- Time delay in when it is written to the log.
37Agenda
- Tuning Tricks
- Design Tricks
- Troubleshooting Tricks
38How to Get the Versions
- PB Version
- Windows
- GetFileVersionInfo window API. See sybase.com
for the white paper - Solaris
- strings JAGUAR/lib/libpbvm70x.so grep Version
- Turn on the verbose mode
- Shows all of the classes that are loaded and
when. - com.sybase.jaguar.server.jvm.verbosetrue
39What Is the Log Telling Me
- Starting Listeners
- Listener 1 TestServer_iiop Active yes
Protocol 'IIOP' 'localhost',9000 Security
Profile 'NONE' - Jul 16 170148 2002 Listener 2
TestServer_http Active yes Protocol 'HTTP'
'localhost',80 Security Profile 'NONE' - Listener File Name - TestServer_iiop
- Protocol - IIOP
- Machine Name - localhost
- Port - 9000
40What Is the Log Telling Me
- Start processes
- Code set being used
- Server's native codeset is iso_1
- Java Library to use. Important for NT service
- Library 'libjjdk12.dll' for component type
'java' - JIT Compiler Option turned on
- com.sybase.jaguar.server.jvm.nojit
- Java JIT Compiler enabled
- Debug option turned on/off
- Java component debugging disabled
- JVM version
- Java virtual machine initialized (version 10002)
- Repository Location
- RepositoryC\Program Files\Sybase\Jaguar CTS
3.5\Repository
41What Is the Log Telling Me
- Other Processes
- Jaguar IP address that is being used.
- Host IP 127.0.0.1
- The URL for the name server
- NameServiceURL iiop//00
- Timeout for
- PermissionCache Authorization cache timeout 120
minutes - Starting EAServer Standard Services
- Starting Services...
- Started Jaguar/Repository
- Started Jaguar/GarbageCollector
- Started Jaguar/JCM
- Starting Jaguar Naming Services...
- Started CosNaming/NamingContext
- Started JaguarServlet/ServletService
42What Is the Log Telling Me
- Other Processes (continued)
- Executing the run method of the services
- Running services...
- Running CosNaming/NamingContext
- Running Jaguar/GarbageCollector
- Running JaguarServlet/ServletService
- Name Services binding complete
- Stopped CosNaming/NamingContext
- Setting Quality of Protection
- Authentication timeout period is 3600 seconds.
- Note authentication timeout can be disabled.
- Authentication lockout period is 600 seconds.
- Note authentication lockout can be disabled.
43Generating a Java Stack Trace
- When java components (EJB or CORBA) have errors
it is good practice to create stack traces. - Done in the catch block
- catch (Exception e)
- System.out.println (e.toString())
- e.printStackTrace()
44Generating a Java Stack Trace
- The output is
- java.lang.NoSuchMethodError powersoft.powerj.db.T
ransaction method setRegisterName(Z)V not found - at surfsidevideo.CleanupServiceImpl.create
(CleanupServiceImpl.java26) - at surfsidevideo.CleanupServiceImpl.run
(CleanupServiceImpl.java120) - at surfsidevideo._sk_SurfSideVideoPJ_CleanupServic
e.invoke (_sk_SurfSideVideoPJ_CleanupService.java
48)
45Reading a Java Stack Trace
- Error Message
- java.lang.NoSuchMethodError
- Offending class/method
- powersoft.powerj.db.Transaction method
setRegisterName - It Occurred at
- surfsidevideo.CleanupServiceImpl.create
- In class
- CleanupServiceImpl
- At line 26
- The rest is where what called the class that
failed
46How to Get Additional Information
- Getting the IIOP stack
- Tells all of the IIOP information that is sent
and used by the server - com.sybase.jaguar.server.iiop.log
- Client application issues, such as login failures
- Component issues
- Method invocation errors
- Result sets not returned as expected
- Trouble connecting to the target database
- Intercomponent call errors
- Warning This will create a LOT of output.
Dont leave on except for a short time.
47Is There a Way to Recover
- JagRepair
- Read only version of the server
- Allows you to make configuration changes that may
be causing the server to crash (OTS, Connection
Cache, Service Components, etc.) - How do I start it
- Serverstart servername JagRepair
- How do I connect to it?
- UserName jagadmin
- Hostname localhost
- Port Number 9000
48Intercomponent Calls
- Naming Conventions
- Proxy vs. Object Name
- Always name the component something OTHER then
the NVO name - Reduces confusion within the PBVM
- May cause varying things to occur
- Intercomponent Calls
- Calling NVO should only access proxy
- Compile into separate libraries
- Name the Proxy different then the Object
49HTML DataWindow
- Always use the JavaScript files
- Reduces the download of the page
- Make the DataWindow updateable
- The Dataobject must be updateable
- For External DataWindow define the table as dummy
- client side scripting
- column must be on the dataobject
- must have a tab order greater then zero
- Not Visible
- Define a visible expression to make column
invisible at runtime - For example, set the visible property expression
to 0 - Pass the browser as an argument
- HTML DataWindow get generate the best-looking
view of your dataobject
50HTML DataWindow (Continued)
- To validate the DataWindow
- User the HTMLContextApplied event
- Validates the data before the action is applied
- Use a user-defined button
- Causes the client side script to pass the context
and action to your component - You can call SetHTMLAction
- which will apply the context
- it does not know what the action is so it will be
ignored - After calling SetHTMLAction
- datastore contains all inserted data, modified
and deleted rows - Then validate and perform action
51JDK Issues
- Some APIs require certain JDKs
- All J2EE 1.2 API require JDK 1.2 or higher
- Example
- Getting a connection cache for a
javax.sql.DataSource and using a 1.1 connect
cache name. - Deployment of 1.3 objects
- XML Descriptors for 1.3 objects will not deploy
because of the DTD at the start of the file. - lt!DOCTYPE application PUBLIC '-//Sun
Microsystems, Inc.//DTD J2EE Application 1.3//EN'
'http//java.sun.com/dtd/application_1_3.dtd'gt
52ClassLoader
- Used by EAServer to find and load object
- java.classes property
- Found in
- Servers (4.0)
- Packages
- Components
- Connectors
- Servlet
- Web Application
- Defines the classes that are required to load a
particular object - Defines the jar file(s) that are needed (in
addition to the bootclasspath) for finding
classes
53ClassLoader Issues
- When comparing classes they need to be loaded at
the same level - Example
- ServletA creates object Foo
- EJB_A creates object Foo
- ServletA passes its Foo to EJB_A as a parm.
EJB_A tries to use Foo from ServletA - Resolution Have the server class loader load Foo
54Debug Flags
- Most functionality in the server has a debug flag
- Documented and undocumented
- com.sybase.jaguar.ltfeaturegt.debug
- Examples
- com.sybase.jaguar.server.http.cache.debug
- com.sybase.jaguar.component.debug
- com.sybase.jaguar.servlet.debug
- Will impact performance
55Questions