Tuesday 15 May 2007

Java and WebSphere Application Server on AIX Internals - Part 1

Well, as I need to keep my brain functioning, I am going to start outlining how Java and the WebSphere Application Server work on this blog. Over the next few days I will cover a few of the internals and things to loook out for.

Firstly, the JVM (J9) from IBM is a sophisticated and powerful JVM. The advanced heuristics in the Just In Time (JIT) compiler have been fairly well covered in the past elsewhere, but in outline the JVM compiles each class and keeps tabs on its usage. When it is compiled it weighs up the resource cost of compilation with optimisation against the cost of execution "as is", and if there is a benefit of optimising then optimisation is performed. As that class is used more and more there are greater benefits of optimisation so JIT compiler may recompiler and optimise the class in the background; replacing the native code implementation in the native code library when the recompile completes. As the code is executed more further iterations of the optimisation may be performed.

In addition to the optimisation, the JVM attempts to share native code across Java instances, using shared memory to communicate between the JVM process instances. A set of controls can be found in /tmp/javasharedresources. Note that the current implementation only shared native code implementions within an LPAR.

Secondly, one of the key differences between WAS 6.0 and WAS 6.1 was the adoption of the OSGI infrastructure and its object model. The Eclipse 3.1.2 implementatiion is used as the base, which is why much of the WAS functionality can be found in Eclipse plugins under the /usr/IBM/WebSphere/AppServer/plugins directory. Like other plugins the Eclipse runtime can preload the OSGI bundles/plugins under the control of the config.ini in the /configuration directory. A simple test of this is to create an OSGI bundle adhering to Eclipse 3.1 and put it in the plugins directory and add it with a "@4:start" entry to config.ini. Note that org.eclipse.core.runtime starts first and then the org.eclipse.update.configurator. Having this new plugin enumerate the plugins, extensions, and extension points it sees via the extension registry gives something like this:

Registry is: org.eclipse.core.internal.registry.ExtensionRegistry@5f075f07
ID: com.ibm.wsspi.extension.server-startup
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.configservice-metadata
-->Extension:com.ibm.ws.runtime.admin_jmx_configservice-metadata
-->Extension:com.ibm.events.client.cei_configservice-metadata
ID: com.ibm.wsspi.extension.webservices
-->Extension:com.ibm.ws.runtime.wsaddressing_impl-webservices
-->Extension:com.ibm.ws.runtime.dynacache-webservices
-->Extension:com.ibm.ws.runtime.pmi_rm-webservices
-->Extension:com.ibm.ws.runtime.security_wssecurity-webservices
-->Extension:com.ibm.ws.runtime.webservices-webservices
-->Extension:com.ibm.ws.runtime.i18n-webservices
-->Extension:com.ibm.ws.runtime.transaction_impl-webservices
-->Extension:null
ID: com.ibm.wsspi.extension.hamanager-startup
-->Extension:null
ID: org.eclipse.core.resources.builders
-->Extension:org.eclipse.jdt.core.javabuilder
ID: org.eclipse.core.runtime.products
-->Extension:org.eclipse.update.configurator.updateConfiguratorProductProvider
ID: com.ibm.wsspi.extension.extension-checker
ID: org.eclipse.team.core.projectSets
ID: org.eclipse.team.core.repository
ID: org.eclipse.core.resources.moveDeleteHook
-->Extension:org.eclipse.team.core.MoveDeleteHook
ID: com.ibm.wsspi.extension.channel-framework-channel-factory-type
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.rrd.rrd-emf-packages
-->Extension:null
ID: com.ibm.wsspi.extension.customBindingProvider
-->Extension:com.ibm.ws.runtime.wsaddressing-customBindingProvider
-->Extension:com.ibm.ws.runtime.transaction-customBindingProvider
-->Extension:com.ibm.ws.sib.server.wsnotification-customBindingProvider
ID: com.ibm.wsspi.extension.webcontainer-startup
-->Extension:null
-->Extension:null
ID: org.eclipse.core.variables.valueVariables
ID: com.ibm.wsspi.extension.taglibcacheconfig-xml
-->Extension:null
ID: com.ibm.wsspi.extension.server-recovery-mode-components
ID: org.eclipse.core.runtime.applications
-->Extension:com.ibm.ws.bootstrap.WSLauncher
-->Extension:com.ibm.ws.debug.osgi.StartConsole
-->Extension:com.ibm.ws.debug.osgi.Noop
-->Extension:com.ibm.ws.runtime.startWsServer
-->Extension:org.eclipse.ant.core.antRunner
ID: com.ibm.wsspi.extension.logger-properties
ID: com.ibm.ws.portletcontainer.portlet-document-filter-config
ID: com.ibm.wsspi.extension.server-components
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.resource-binders
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.app-depl-providers
-->Extension:com.ibm.ws.migration.Migration-app-depl-provider
-->Extension:com.ibm.ws.runtime.appprofile_impl-app-depl-providers
-->Extension:com.ibm.ws.runtime.security_impl-app-depl-providers
-->Extension:com.ibm.ws.runtime.prereq_amwas-app-depl-provider
-->Extension:com.ibm.ws.runtime.security_wssecurity-app-depl-providers
-->Extension:com.ibm.ws.runtime.webservices_app-depl-providers
-->Extension:null
-->Extension:null
-->Extension:com.ibm.ws.sip.container.WARToSARListener-app-depl-providers
-->Extension:com.ibm.ws.sip.container.SARToEARWrapperProvider-app-depl-providers
ID: com.ibm.ws.bootstrap.manual-bundle-start
-->Extension:null
ID: com.ibm.wsspi.extension.server-control-region-components
ID: com.ibm.wsspi.extension.server-model-init
-->Extension:com.ibm.ws.wccmbase.base_model_init
-->Extension:com.ibm.events.client.cei_model_init
-->Extension:com.ibm.ws.sib.wccm.sib_model_init
-->Extension:com.ibm.ws.sib.wccm.sib_resource_model_init
-->Extension:com.ibm.ws.sib.wccm.wsn_model_init
ID: org.eclipse.jdt.core.classpathContainerInitializer
-->Extension:null
ID: com.ibm.ws.bootstrap.applications
-->Extension:com.ibm.ws.migration.WASPreUpgrade
-->Extension:com.ibm.ws.migration.WASPostUpgrade
-->Extension:com.ibm.ws.migration.ConvertScriptCompatibility
-->Extension:com.ibm.ws.migration.ClientUpgrade
-->Extension:com.ibm.ws.runtime.RetrieveSigners
-->Extension:com.ibm.ws.runtime.WsAdmin
-->Extension:com.ibm.ws.runtime.CollectManagedObjectMetadata
-->Extension:com.ibm.ws.runtime.WsServerLauncher
-->Extension:com.ibm.ws.runtime.WsServer
-->Extension:com.ibm.ws.runtime.WsServerStop
-->Extension:com.ibm.ws.runtime.ServerStatus
-->Extension:com.ibm.ws.runtime.LaunchBatchCompiler
-->Extension:com.ibm.ws.runtime.LaunchWSAnt
-->Extension:com.ibm.ws.runtime.BackupConfigUtility
-->Extension:com.ibm.ws.runtime.RestoreConfigUtility
-->Extension:com.ibm.ws.runtime.FindEJBTimersCommand
-->Extension:com.ibm.ws.runtime.CancelEJBTimersCommand
-->Extension:com.ibm.ws.runtime.LaunchClient
-->Extension:com.ibm.ws.runtime.LaunchClientApi
-->Extension:com.ibm.ws.runtime.NodeFederationUtility
-->Extension:com.ibm.ws.runtime.NodeUninstallPrep
-->Extension:com.ibm.ws.runtime.NodeCleanupUtility
-->Extension:com.ibm.ws.runtime.NodeRemovalUtility
-->Extension:com.ibm.ws.runtime.NodeSyncUtility
-->Extension:com.ibm.ws.runtime.NodeRenameUtility
-->Extension:com.ibm.ws.runtime.DumpExtensionRegistry
-->Extension:com.ibm.ws.runtime.WsProfile
-->Extension:com.ibm.ws.runtime.WsProfileAdminListener
-->Extension:com.ibm.uddi.UDDIValueSet
ID: com.ibm.wsspi.rrd.generators
-->Extension:null
ID: org.eclipse.jdt.core.codeFormatter
ID: org.eclipse.jdt.core.classpathVariableInitializer
ID: org.eclipse.core.resources.teamHook
-->Extension:org.eclipse.team.core.TeamHook
ID: com.ibm.wsspi.extension.protectedclasses-policy
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.serializable
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.ws.portletcontainer.collaborator-config
-->Extension:null
ID: org.eclipse.team.core.fileTypes
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.cache-resourcemgr-config
-->Extension:null
ID: com.ibm.wsspi.extension.managed-object-metadata-collector
-->Extension:com.ibm.ws.runtime.admin_jmx_managed-object-metadata-collector
-->Extension:null
ID: org.eclipse.core.variables.dynamicVariables
ID: com.ibm.wsspi.extension.ejbcontainer-startup
-->Extension:null
ID: com.ibm.wsspi.extension.soap-request-monitor
-->Extension:com.ibm.ws.runtime.transaction_impl-soap-request-monitor
ID: com.ibm.wsspi.extension.server-config
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.pmiJmxMapperExtension
ID: org.eclipse.ant.core.antProperties
-->Extension:null
ID: com.ibm.wsspi.extension.channel-framework-channel-type
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.syswebservices
-->Extension:com.ibm.ws.runtime.wsaddressing_impl-syswebservices
-->Extension:com.ibm.ws.runtime.webservices-syswebservices
ID: org.eclipse.core.runtime.adapters
-->Extension:org.eclipse.core.resources.org.eclipse.core.resources.resourceMappingAdapters
ID: org.eclipse.team.core.ignore
ID: com.ibm.wsspi.extension.client-components
ID: com.ibm.wsspi.extension.service-provider
-->Extension:com.ibm.ws.runtime.webservices-service-provider
-->Extension:com.ibm.ws.sib.server.sib-service-provider
ID: com.ibm.ws.bootstrap.resource-file
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:null
ID: com.ibm.wsspi.extension.scheduler-startup
-->Extension:null
ID: org.eclipse.core.resources.refreshProviders
ID: org.eclipse.ant.core.antTypes
ID: com.ibm.wsspi.extension.admin-command-def
-->Extension:com.ibm.ws.runtime.Runtime
-->Extension:null
-->Extension:null
-->Extension:null
-->Extension:com.ibm.ws.s

Note how much of the WAS internals in the core runtime (com.ibm.ws.runtime.....) and what sits upon it are now based on Eclipse plugins/OSGI bundles and extensions, services, and extension points.

Over the next few weeks I will add more to this.

Note that the platform.xml file in the org.eclipse.update directory under configuiration directory is updated each startup by the org.eclipse.update.configurator plugin and controls which WAS features are installed. This can be played with (at least will be when IBM have done more) to reduce the footprint of WAS. This is also likely to be used for the feature packs coming out now.

<?xml version="1.0" encoding="UTF-8"?>
<config date="1176138175560" transient="false" version="3.0">
<site enabled="true" policy="USER-EXCLUDE" updateable="true" url="platform:/base/">
<feature id="com.ibm.ws.uddi" url="features/com.ibm.ws.uddi_6.0.0.0/" version="6.0.0.0">
</feature>
<feature id="com.ibm.ws.wsgateway" url="features/com.ibm.ws.wsgateway_6.0.0.0/" version="6.0.0.0">
</feature>
<feature id="com.ibm.ws.base" url="features/com.ibm.ws.base_6.0.0.0/" version="6.0.0.0">
</feature>
<feature id="com.ibm.events.service" url="features/com.ibm.events.service_6.1.0.0/" version="6.1.0.0">
</feature>
<feature id="com.ibm.ws.express" url="features/com.ibm.ws.express_6.0.0.0/" version="6.0.0.0">
</feature>
<feature id="com.ibm.ws.j2ee" url="features/com.ibm.ws.j2ee_6.0.0.0/" version="6.0.0.0">
</feature>
<feature id="com.ibm.ws.taskmanagement" url="features/com.ibm.ws.taskmanagement_6.1.0.0/" version="6.1.0.0">
</feature>
<feature id="com.ibm.ws.nd" url="features/com.ibm.ws.nd_6.0.0.0/" version="6.0.0.0">
</feature>
</site>
</config>
</quote>

The OSGI infrastructure had some issues with the JVM shared native code across JVMs so some modifications have been included.

Other tools for poking around are the dumpExtensionRegistry.sh script which is run against a server config to get a picture of what is going on:

ADMU0116I: Tool information is being logged in file
/usr/IBM/WebSphere/AppServer/profiles/sandpit/logs/server1/ExtensionRegistry.log
ADMU0128I: Starting tool with the sandpit profile
ADMU0506I: Server name: server1

==============================================================================
Beginning of Extension Registry Dump
==============================================================================

Plug-in: com.ibm.ws.isc [1.0.0] (active)
Name: WS_Server
Provider: IBM
Location: file:/usr/IBM/WebSphere/AppServer/systemApps/isclite.ear/isclite.war/WEB-INF/plugin.xml
1 Extension(s);
Extension: ibmautogeneratedidentifier1 (active)
Target ExtensionPoint: com.ibm.ws.portletcontainer.collaborator-config
No Extension Points defined

Plug-in: com.ibm.ws.portletcontainer [2.0.0] (active)
Name: WS_Server
Provider: IBM
Location: jar:file:/usr/IBM/WebSphere/AppServer/lib/pc-appext.jar!/plugin.xml
No Extensions defined
2 Extension Point(s);
ExtensionPoint: collaborator-config (active)
Name: Portlet Container Collaborator Extension Point
Schema: null
1 Extension(s) attached;
com.ibm.ws.isc.ibmautogeneratedidentifier1 [1.0.0]
ExtensionPoint: portlet-document-filter-config (active)
Name: Portlet Document Filter Extension Point
Schema: null
No Extensions attached

Plug-in: com.ibm.wsspi.rrd [6.1.0] (active)
Name: WS_RemoteRequestDispatcher
Provider: IBM
Location: jar:file:/usr/IBM/WebSphere/AppServer/lib/rrd-appext.jar!/plugin.xml
No Extensions defined
4 Extension Point(s);
ExtensionPoint: generators (active)
Name: RemoteRequestDispatcher Extension Generator Extension Point
Schema: null
No Extensions attached
ExtensionPoint: handlers (active)
Name: RemoteRequestDispatcher Extension Handler Extension Point
Schema: null
No Extensions attached
ExtensionPoint: rrd-emf-packages (active)
Name: RRD EMF Package Initialization Extension Point
Schema: null
No Extensions attached
ExtensionPoint: rrd-extension-delegator (active)
Name: RemoteRequestDispatcher Extension Delegator Extension Point
Schema: null
No Extensions attached

Plug-in: org.eclipse.extensionregistry [1.0.0] (active)
Name: Extension Registry Core
Provider: IBM
Location: bundleresource://13/app-plugin.xml
No Extensions defined
2 Extension Point(s);
ExtensionPoint: RegistryFilter (active)
Name:
Schema: schema/RegistryFilter.exsd
No Extensions attached
ExtensionPoint: RegistryInstance (active)
Name:
Schema: schema/RegistryInstance.exsd
No Extensions attached

==============================================================================
End of Extension Registry Dump
==============================================================================

Interesting, isn't it?

As for all plugins, the MANIFEST.MF or plugin.xml files give information as to what extensions are in use and what the extension points are. For your own applications on top of WAS IBM recommend using JNDI to get access to the Extension Registry, so it is supported!

At some point I'll go through the different plugin configs in each of the runtime bundles/plugins, starting with the com.ibm.ws.runtime that underpins all of WAS.

Enjoy and I hope this helps!

Night, night!

No comments: