Session No. Presentation Title - PowerPoint PPT Presentation

1 / 57
About This Presentation
Title:

Session No. Presentation Title

Description:

Some settings must be made on the OS to improve performance. ... NNN bytes, kilobytes, or megabytes (default: bytes) Or, defined as size' property in: ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 58
Provided by: sybas
Category:

less

Transcript and Presenter's Notes

Title: Session No. Presentation Title


1
E144 EAServer Tips and Tricks
  • Scott McReynolds
  • Engineering Manager
  • e-Business
  • scottmc_at_sybase.com

2
Agenda
  • Tuning Tricks
  • Design Tricks
  • Troubleshooting Tricks

3
OS 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

4
OS 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

5
Flow 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.
6
Flow 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.

7
JNI Compiler Changes
  • C proxies for accessing java classes and
    interfaces.
  • C classes for implementing java native methods.
  • Substitute the pseudo-component calls for
    JavatoServer, ServertoJava, and ObjectContext
    components.
  • com.sybase.jaguar.server.servertojavacall
  • com.sybase.jaguar.server.javatoservercall
  • The value should be a string either "JNI", to
    specify using JNI calls, or "PseudoComp" to
    specify using Pseudo-Component calls

8
Purpose 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.

9
Benefits 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.

10
Performance 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.

11
Cache OptionsSimple 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.sevlet.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.

12
Cache OptionsSimple 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.

13
Cache 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).

14
Cache 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).

15
Role 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.

16
Transaction 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).

17
Transaction 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.

18
Cache Configuration
  • Property com.sybase.jaguar.component.objectCache
    Value CtsComponents/ObjectCache
  • (if not set, default behaviour is to disable
    caching)
  • Cache Name
  • Cache Size
  • Cache Timeout
  • Cache Synchronization

19
Cache Name
  • Property
  • com.sybase.jaguar.component.objectCache.name
  • Value
  • MyNamedCache
  • Optional
  • When specified, this is the name of a cache area
    that can be shared for caching the state of
    multiple component types.
  • Avoids the requirement to specify a cache size
    for each cached component, instead the cache size
    can be set on the named cache.

20
Cache Size
  • Property
  • com.sybase.jaguar.component.objectCache.size
  • Value
  • NNN bytes, kilobytes, or megabytes (default
    bytes)
  • Or, defined as size property in
  • Repository/Component/ObjectCache/MyNamedCache.prop
    s
  • Specifies the maximum size of the object
    cache.(Cache space is allocated on demand, not
    pre-allocated, so the minimum size is zero).
  • When a new entry is added to a full cache, one or
    more LRU (least recently used) entries are
    flushed to make sufficient space.

21
Cache Timeout
  • Property
  • com.sybase.jaguar.component.objectCache.timeout
  • Value
  • NNN (seconds) Or, defined as timeout
  • Property
  • Repository/Component/ObjectCache/MyNamedCache.prop
    s
  • Specifies the expiry time for cache entries. The
    default value of zero means cache entries do not
    expire.
  • When a named cache is used, the timeout for the
    component (if specified) overrides the timeout
    for the named cache.

22
Cache Synchronization
  • Property
  • com.sybase.jaguar.component.objectCache.sync
  • Legal Values
  • none, mirror, replicate, invalidate
  • Or, defined as sync
  • Property
  • Repository/Component/ObjectCache/MyNamedCache.pro
    ps
  • Specifies the synchronization mechanism for cache
    entries when running in a cluster.
  • When a named cache is used, the sync option for
    the component (if specified) overrides the sync
    option for the named cache.

23
Component 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

24
Component SettingsCMP 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 beforeCompletion to only do stores
    before the completion of a transaction

25
Component SettingsEJB Settings
  • Use local interface instead of remote interface
  • Causes less marshalling
  • Parms are passed by reference instead of by copy

26
Component SettingsPB 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

27
Component SettingsPB 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

28
Component SettingsPB 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.

29
Web 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

30
Web Application Settings
  • Turn off HTTP logging
  • Done via Jaguar Manager
  • Ensure 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

31
Web 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.

32
Agenda
  • Tuning Tricks
  • Design Tricks
  • Troubleshooting Tricks

33
Design 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

34
Design 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.

35
Design 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.

36
Design 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

37
Design 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.

38
Agenda
  • Tuning Tricks
  • Design Tricks
  • Troubleshooting Tricks

39
How 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

40
What 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

41
What 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

42
What 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

43
What 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.

44
Generating 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)
  • e.toString()
  • e.printStackTrace()

45
Generating 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)

46
Reading 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

47
How 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.

48
Is 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

49
Intercomponent 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

50
HTML 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

51
HTML DataWindow (Continued)
  • Pass the browser as an argument
  • HTML DataWindow get generate the best-looking
    view of your dataobject
  • To validate the DataWindow
  • User the HTMLContextApplied event
  • Validates the data before the action is applied

52
HTML DataWindow (Continued)
  • To validate the DataWindow (continued)
  • 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

53
JDK 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

54
ClassLoader
  • Used by EAServer to find and load object
  • java.classes property
  • Found in
  • Servers (4.0)
  • Packages
  • Components
  • Connectors
  • Servlet
  • Webapplication
  • 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

55
ClassLoader 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

56
Debug 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

57
Questions
Write a Comment
User Comments (0)
About PowerShow.com