[Design of POJO Server] - Various performance issues in core projects
by jaikiran
While working on EJBTHREE-1800, we found that most of the issues were either related to AOP or MC. So i created a simple plain MC app (no EJBs in picture) with 101 MC beans and each MC bean having 100 methods each. Like this:
| package org.myapp.mc;
|
| import org.jboss.beans.metadata.api.annotations.*;
|
| public class MCBean2
| {
|
| @Inject
| private SomeOtherInterface otherBean;
|
|
| public SomeOtherInterface getOtherBean()
| {
| return this.otherBean;
| }
|
|
|
| public void method1(){}
| public void method2(){}
| public void method3(){}
| public void method4(){}
| public void method5(){}
| public void method6(){}
| public void method7(){}
| public void method8(){}
| public void method9(){}
|
Each MC bean has just one plain @Inject and 100 non-annotated methods. When i deployed this on my system, it took close to 2 seconds for this to be deployed. There's nothing fancy in this application, so i would have expected this to be faster. But this timing aligns with what we are seeing with the EJB3 deployment (we do not deploy the EJB impl class as MC beans but we do deploy the EJB containers as MC beans).
Based on what i could see for this plain MC application in JProfiler, here are the issues (so far):
1) As mentioned in the other thread, MC looks for annotations on every method on every MC bean for annotation plugins (org.jboss.kernel.plugins.annotations.CommonAnnotationAdapter). So 100 methods * 101 beans. During this process, the call leads to org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader.getComponentMetaDataRetrieval which has this code:
SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
|
similarly for constructors and fields:
| constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
|
| field = SecurityActions.findField(clazz, signature.getName());
|
This call ultimately leads to org.jboss.reflect.plugins.introspection.ReflectionUtils.findMethod/findField/findConstructor, which have code like this:
| public static Method findMethod(Class<?> clazz, String name, Class<?>... parameterTypes)
| {
| if (clazz == null)
| return null;
|
| Method[] methods = clazz.getDeclaredMethods();
| if (methods.length != 0)
| {
| for (Method method : methods)
| {
| if (method.getName().equals(name))
| {
| Class<?>[] methodParams = method.getParameterTypes();
| if (methodParams.length != 0)
| {
| if (Arrays.equals(methodParams, parameterTypes))
| return method;
| }
| else if (parameterTypes == null || parameterTypes.length == 0)
| return method;
| }
| }
| }
| return findMethod(clazz.getSuperclass(), name, parameterTypes);
| }
|
|
|
Same applies for the findConstructor and findField. As can be seen, this method calls the expensive Class.getDeclaredMethods() and then iterates over the method to figure out the correct method. Remember, this method gets called for each method on each MC bean (100 * 101 for this application alone) which ultimately leads to performance issues. Profiler shows me there are 33232 calls to the Class.getDeclaredMethods() each taking an average of 297 micro sec. I changed the implementation of these methods (findMethod, findConstructor and findField) and see good enough performance improvements:
| public static Method findMethod(Class<?> clazz, String name, Class<?>... parameterTypes)
| {
| if (clazz == null)
| return null;
|
| try
| {
| Method method = clazz.getDeclaredMethod(name, parameterTypes);
| return method;
| }
| catch (SecurityException se)
| {
| throw se;
| }
| catch (NoSuchMethodException nsme)
| {
| // check on superclass if present
| if (clazz.getSuperclass()!=null)
| {
| return findMethod(clazz.getSuperclass(), name, parameterTypes);
| }
| else
| {
| return null;
| }
|
| }
|
| }
|
The calls to the less expensive Class.getDeclaredMethod and Class.getDeclaredField (and so on..) show that the average time of the calls has drastically dropped down to 9 micro sec.
This issue is similar to the one i reported here (in a different class) http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154875
2) The org.jboss.kernel.plugins.annotations.CommonAnnotationAdapter iterates over each method to apply the annotation plugins for those methods:
| ...//code trimmed
| Set<MethodInfo> methods = info.getMethods();
| if (methods != null && methods.isEmpty() == false)
| {
| for(MethodInfo mi : methods)
| {
| ClassInfo declaringCI = mi.getDeclaringClass();
| // direct == check is OK
| if (declaringCI != objectTI && visitedMethods.contains(mi) == false)
| {
| Signature mis = new MethodSignature(mi);
| MetaData cmdr = retrieval.getComponentMetaData(mis);
| if (cmdr != null)
| {
| methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
| for(T plugin : methodPlugins)
| {
| if (isApplyPhase)
| applyPlugin(plugin, mi, cmdr, handle);
| else
| cleanPlugin(plugin, mi, cmdr, handle);
| }
| //code trimmed
|
As can be seen, during this process the getPlugins(...) is called for each method even though the getPlugins(...) is not per method specific. The getPlugins internally iterates over the available plugins (which are a lot) and then applies filtering for each annotation class and does other stuff. The call to this method can be moved out of the loop to improve the performance:
| Set<MethodInfo> methods = info.getMethods();
| if (methods != null && methods.isEmpty() == false)
| {
| //moved out of loop
| methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
| for(MethodInfo mi : methods)
| {
| ClassInfo declaringCI = mi.getDeclaringClass();
| // direct == check is OK
| if (declaringCI != objectTI && visitedMethods.contains(mi) == false)
| {
| Signature mis = new MethodSignature(mi);
| MetaData cmdr = retrieval.getComponentMetaData(mis);
|
|
This too shows an improvement in the performance.
3) The org.jboss.kernel.plugins.annotations.CommonAnnotationAdapter also has a piece of code which looks for static methods:
| // static methods
| MethodInfo[] staticMethods = getStaticMethods(classInfo);
| if (staticMethods != null && staticMethods.length != 0)
| {
| for(MethodInfo smi : staticMethods)
| {
|
| if (smi.isStatic() && smi.isPublic())
| {
| Signature mis = new MethodSignature(smi);
| MetaData cmdr = retrieval.getComponentMetaData(mis);
| if (cmdr != null)
| {
| if (methodPlugins == null)
| methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
|
| for(T plugin : methodPlugins)
| {
| if (isApplyPhase)
| applyPlugin(plugin, smi, cmdr, handle);
| else
| cleanPlugin(plugin, smi, cmdr, handle);
| }
| }
|
| /**
| * Get the static methods of class info.
| *
| * @param classInfo the class info
| * @return the static methods
| */
| protected MethodInfo[] getStaticMethods(ClassInfo classInfo)
| {
| return classInfo.getDeclaredMethods();
| }
|
I think the call to classInfo.getDeclaredMethods() can again be avoided, since we already have the methods of this class (a few lines before this call). So this change/fix:
| // static methods
| if (methodPlugins == null)
| methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
|
| for (MethodInfo method : methods)
| {
| // if the method was already visited, then no point processing it again
| if (!visitedMethods.contains(method))
| {
| // ensure that the method is static and is declared in the class being processed
| if(method.isStatic() && method.getDeclaringClass().equals(classInfo))
| {
| Signature mis = new MethodSignature(method);
| MetaData cmdr = retrieval.getComponentMetaData(mis);
|
| if (cmdr != null)
| {
| for(T plugin : methodPlugins)
| {
| if (isApplyPhase)
| applyPlugin(plugin, method, cmdr, handle);
| else
| cleanPlugin(plugin, method, cmdr, handle);
| }
| }
| else if (trace)
| log.trace("No annotations for " + method);
| }
| }
|
| }
|
4) Deployers - I see that every MC bean that gets deployed, also gets registered as a MBean. Is this required? During the MBean registration, i saw this piece of code (which Jprofiler shows as expensive, given the number of MC beans being registered as MBean) in org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java:
| public ObjectName getObjectName()
| {
| if (objectName == null)
| {
| String name = getName();
| name = name.replace("\"", """);
| String temp = "jboss.deployment:id=\"" + name + "\",type=Component";
|
The String.replace is marked as a costly operation. I changed this to:
| Index: src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
| ===================================================================
| --- src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java (revision 87763)
| +++ src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java (working copy)
| @@ -139,8 +139,9 @@
| if (objectName == null)
| {
| String name = getName();
| - name = name.replace("\"", """);
| - String temp = "jboss.deployment:id=\"" + name + "\",type=Component";
| + //name = name.replace("\"", """);
| + name = ObjectName.quote(name);
| + String temp = "jboss.deployment:id=" + name + ",type=Component";
| try
| {
| objectName = new ObjectName(temp);
|
|
The question however still remains, do we really need to register each MC bean as a MBean?
With all these changes (across various projects), i have been able to deploy that sample application now within around 1.1 seconds(which i think is still on the higher side). I am going to continue looking into other issues and see how much improvement it brings in to the EJB3 deployments.
P.S: I have all the patches ready if anyone wants to take a look.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229402#4229402
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229402
16 years, 11 months
[Design of JBoss jBPM] - Re: New console snapshot published, Task Forms included
by tom.baeyens@jboss.com
is there an example in the source code ? i couldn't find a .ftl in the sources
ideally, such a template example would be included in the distro. in the examples in the distribution, there is an ant script to deploy all the examples to a running database.
it would be great if the task examples could include forms, and that the example.bar deployment in the script would include the .ftl task form resources.
the idea is that the user downloads and unzips jbpm, then runs a target that installs jboss, jbpm into jboss, start the jboss server, loads the example identities, deploys the example processes, installs and starts eclipse.
then users would have a web app in which they can start browsing and trying things out.
i'll see if i can start from your description here and get a task form running on the first task example
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229399#4229399
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229399
16 years, 11 months
[JBoss Portal Documentation] - NEW Farma!!!! Viagra, Parlodel, Femcare
by farma_best
<a href=http://shop.best-farma.co.cc/>http://s58.radikal.ru/i161/0905/b7/e0786e78e907.jpg
http://www.linkbrander.com/go/76486
<a href=http://www.linkbrander.com/go/76486/>24 hour pharmacy
<a href=http://www.linkbrander.com/go/76486/>24 hours pharmacy
<a href=http://www.linkbrander.com/go/76486/>a pharmacy
<a href=http://www.linkbrander.com/go/76486/>about pharmacy
<a href=http://www.linkbrander.com/go/76486/>adipex online
<a href=http://www.linkbrander.com/go/76486/>aid pharmacy
<a href=http://www.linkbrander.com/go/76486/>and pharmacy
<a href=http://www.linkbrander.com/go/76486/>at the pharmacy
<a href=http://www.linkbrander.com/go/76486/>ativan pharmacy
<a href=http://www.linkbrander.com/go/76486/>australia online
<a href=http://www.linkbrander.com/go/76486/>bc pharmacy
<a href=http://www.linkbrander.com/go/76486/>beat pharmacy wikkid
<a href=http://shop.best-farma.co.cc/>beat pharmacy wikkid times
<a href=http://shop.best-farma.co.cc/>best online pharmacy
<a href=http://shop.best-farma.co.cc/>best pharmacy
<a href=http://shop.best-farma.co.cc/>buy online
<a href=http://shop.best-farma.co.cc/>buy pharmacy
buy pharmacy info
canada online
canada pharmacy
canadian online pharmacy
canadian pharmacy
canadian pharmacy online
caremark
cheap online
cheap online pharmacy
cheap pharmacy
cheap pharmacy online
cheap pharmacy online rx
cheap pharmacy online rx com
chemist
chemists
clinical pharmacy
cod online
college of pharmacy
com/pharmacy
compounding
degree online
dexedrine
discount
discount pharmacy
dispensing
doctor online
drug online
drug store
drug stores
drugs online
drugs pharmacy
drugs pharmacy net
drugstore online
drugstore pharmacy
eckerd pharmacy
european pharmacy
eva pharmacy
faculty of pharmacy
fast online
fioricet online
first pharmacy
for pharmacy
formulary
generic online
generic online pharmacy
generic pharmacy
good pharmacy
homeopathic pharmacy
hospital pharmacy
hospitals
hour pharmacy
hours pharmacy
hydrocodone
hydrocodone online
in pharmacy
international pharmacy
internet pharmacy
journal of pharmacy
journal of pharmacy and
line pharmacy
london school of pharmacy
medication
medications
medicine and pharmacy
medicine online
medicines
meds online
mexican pharmacy
mg online
modafinil
of medicine and pharmacy
of pharmacy
of pharmacy and
of pharmacy and pharmacology
of pharmacy in
of pharmacy technician
official pharmacy
online buy
online canada
online consultation
online degree
online delivery
online doctor
online drug
online drug store
online drugs
online drugstore
online medicine
online order
online ordering
online pet
online pharmacies
online pharmacy
online pharmacy no
online pharmacy no prescription
online phentermine
online prescriptions
online price
online sale
online shipping
online tramadol
online-prescription
order
order online
order pharmacy
organic pharmacy
pet online
pharm
pharmaceutical
pharmaceuticals
pharmacie
pharmacies
pharmacist
pharmacists
pharmacy
pharmacy affiliate
pharmacy affiliate program
pharmacy and pharmacology
pharmacy assistant
pharmacy chain
pharmacy chain 36.6
pharmacy chains
pharmacy checker
pharmacy college
pharmacy com ua
pharmacy companies
pharmacy company
pharmacy drug
pharmacy education
pharmacy express
pharmacy forum
pharmacy hotnewsletter
pharmacy hotnewsletter net
pharmacy in london
pharmacy in usa
pharmacy inc
pharmacy industry
pharmacy info
pharmacy is
pharmacy job
pharmacy jobs
pharmacy kiev
pharmacy kiev ua
pharmacy locations
pharmacy london
pharmacy ltd
pharmacy market
pharmacy museum
pharmacy net
pharmacy news
pharmacy of sound
pharmacy on
pharmacy on line
pharmacy online
pharmacy online rx
pharmacy online rx com
pharmacy org
pharmacy practice
pharmacy retail
pharmacy review
pharmacy school
pharmacy schools
pharmacy search
pharmacy services
pharmacy shop
pharmacy store
pharmacy tech
pharmacy technician
pharmacy technician in
pharmacy uk
pharmacy university of
pharmacy usa
pharmacy vol
pharmacy volume
pharmacy wikkid
pharmacy wikkid times
pharmacy zp
pharmacy zp ua
pharmacy.co
pharmacy.com
phentermine
phentermine-online
pills online
prescription
prescription drugs
prescription online
prescription-pharmacy
prescriptions
price
price online
provigil
purchase
rite aid
rite aid pharmacy
riteaid
russian pharmacy
russian pharmacy in
rx
rx online
rx pharmacy
salary
sale online
school of pharmacy
soma online
steroids online
superdrug
the first pharmacy
the pharmacy
tijuana pharmacy
tramadol online
university pharmacy
vicodin
wallgreens
without prescription
worldwide pharmacy
worldwide pharmacy net
www cheap pharmacy
www cheap pharmacy online
www pharmacy zp
www pharmacy zp ua
www.pharmacy
xanax
xanax online
Men Drugs Shop
Category: Allergy
Allegra
Astelin
Atarax
Clarinex
Claritin
Periactin
Phenergan
Prednisone
Zyrtec
Category: Anti Fungal
Diflucan
Grifulvin V
Lamisil
Lotrisone
Mentax
Nizoral
Category: Anti Viral
Bactroban
Combivir
Epivir
Famvir
Rebetol
Retrovir
Valtrex
Zovirax
Category: Anti-Acidity
Metoclopramide
Category: Anti-Depressant
Abilify
Celexa
Cymbalta
Desyrel
Effexor
Elavil
Endep
Lexapro
Loxitane
Luvox
Pamelor
Paxil
Prozac
Risperdal
Seroquel
Sinequan
Tofranil
Wellbutrin
Zoloft
Zyprexa
Category: Antibiotics
Albenza
Amoxil
Ampicillin
Augmentin
Bactrim
Biaxin
Ceclor
Cephalexin
Chloromycetin
Cipro
Cleocin
Doxycycline
Duricef
Flagyl
Floxin
Ilosone
Keflex
Levaquin
LIV52
Lukol
Minomycin
Myambutol
Omnicef
Prograf
Rulide
Septilin
Sumycin
Suprax
Symmetrel
Trecator-SC
Trimox
Vantin
Zithromax
Zyvox
Arava
Benemid
Didronel
Evista
Feldene
Ibuprofen
Relafen
Category: Asthma
Advair Diskus
Beclovent
Brahmi
Flovent Aerosol
Pulmicort
Serevent
Singulair
Ventolin
Category: Blood Pressure
Accupril
Aceon
Adalat
Aldactone
Altace
Atacand
Avapro
Calan
Capoten
Cardarone
Cardizem
Cardura
Cordarone
Coreg
Coumadin
Cozaar
Diltiazem
Diltiazem HCl
Diovan
Enalapril
Florinef
Furosemide
Hytrin
Hyzaar
Imdur
Inderal
Isosorbide Mononitrate
Kerlone
Lanoxin
Lasix
Lisinopril
Lopid
Lopressor
Lotensin
Lozol
Mexitil
Mextil
Micardis
Microzide
Minipress
Norvasc
Persantine
Plavix
Plendil
Tenormin
Toprol XL
Trandate
Vasotec
Vastarel
Verapamil
Zebeta
Zestoretic
Zestril
Category: Cancer
Arimidex
Casodex
Eulexin
Hydrea
Methotrexate
Nolvadex
Xeloda
Category: Cholesterol
Crestor
Gemfibrozil
Lipitor
Mevacor
Pravachol
Shuddha Guggulu
Tricor
Vytorin
Zetia
Zocor
Category: Diabetes
Actoplus Met
Actos
Amaryl
Avandamet
Avandia
Diabecon
Glucophage
Glucotrol
Prandin
Starlix
Category: Erectile Dysfunction
Category: Erection Packs
Viagra 10 pills x 100 mg + Cialis 10 pills x 20 mg
Viagra 10 pills x 100 mg + Cialis 10 pills x 20 mg + Levitra 10 pills x 20 mg
Viagra 30 pills x 100 mg + Cialis 10 pills x 20 mg
Viagra Soft 10 pills x 100 mg + Cialis Soft 10 pills x 20 mg
Category: Eye Drops
Atropisol
Betagan
Betoptic
Ophthacare
Category: Fat Burners
Category: Gastrointestinal
Aciphex
Carafate
Cimetidine
Colospa
Diarex
Maxolon
Motilium
Nexium
Pepcid
Prevacid
Prilos
Protonix
Reglan
Zantac
Category: General Health
Abana
Accutane
Acne-n-Pimple Cream
Acticin
Antabuse
Aricept
Atrovent
Benzac
Betapace
Brand Temovate
Calcium Carbonate
Clarina
Coral Calcium
Daivonex
Depakote
Detrol
Diamox
Differin
Dilantin
Eurax
Exelon
Geriforte
Heart Shield (Heart Disease)
Karela
Kemadrin
Lamictal
Lariam
Leukeran
Levothroid
Levoxyl
Mestinon
Neomercazole
Oxytrol
Primaquine
Purim
Retin-A
Snoroff
Styplon
Sustiva
Synthroid
Topamax
Triphala
Tulasi
Valporic acid ER
Vermox
Viramune
Zerit
Zofran
Category: Hair Care
Finasteride
Hair Loss Cream
Propecia
Rogaine
Selsun
Category: Herbal Products
Category: Insomnia
SleepWell (Herbal Xanax)
Category: Men's Health
Apcalis SX
Apcalis SX Oral Jelly (Orange flavor)
Avodart
Brand Cialis
Brand Levitra
Brand Viagra
Caverta
Cialis
Cialis Professional
Cialis Soft
Cialis Super Active
Cloud Nine BigPRX
Cloud Nine HGH
Cloud Nine Regrowth+
Dutas
Flomax
Himcolin
Himplasia
Kamagra
Kamagra Flavored
Lasuna
Levitra
Penegra
Penisol
Proscar
Silagra
Speman
Tadacip
Tadalis SX
Tentex Forte
Tentex Royal
Viagra
Viagra Capsules
Viagra Flavored
Viagra Oral Jelly
Viagra Professional
Viagra Soft
Viagra Super Active
Category: Other
Ashwagandha
Azulfidine
Buspar
Confido
Cyklokapron
Cystone
Cytotec
Danocrine
Dostinex
Duphalac
Elimite
Gasex
Geodon
Imodium
Imuran
Kytril
Mentat
Sinemet
Tegretol
Zyloprim
Category: Pain medicine
Aleve
Arcoxia
Cafergot
Celebrex
Deltasone
Ditropan
Emulgel
Imitrex
Indocin
Lioresal
Maxalt
Mobic
Monoket
Motrin
Naprosyn
Neurontin
Nimotop
Shallaki
Tizanidine
Tylenol (Acetaminophen)
Urispas
Voltaren
Voltarol
Zanaflex
Category: Penis Enlargement
VPXL -
Category: Stop Smoking
Nirdosh
Zyban
Category: Test Stimulants
Category: Weight Loss
Acomplia
Cloud Nine Hoodia 800
Hoodia
Slimfast (Herbal Phentermine)
Xenical
Zimulti
Category: Women's health
Alesse
Aygestin
Clomid
Danazol
Duphaston
Evecare
Female Viagra
Femara
Femcare
Fosamax
Gestanin
Gyne-Lotrimin
Lynoral
Menosan
Norimin
Norplant
Ovral
Parlodel
Ponstel
Premarin
Provera
Sarafem
Serophene
Shoot
Zelnorm
http://shop.best-farma.co.cc/
http://www.linkbrander.com/go/76486
http://map.b13.su/
http://allmap.hostevo.com/
http://allmap.hostevo.com/map1.html
http://allmap.hostevo.com/map2.html
http://allmap.hostevo.com/map3.html
http://allmap.hostevo.com/map4.html
http://allmap.hostevo.com/map5.html
http://allmap.hostevo.com/map6.html
http://allmap.hostevo.com/map7.html
http://allmap.hostevo.com/map8.html
http://allmap.hostevo.com/map9.html
http://allmap.hostevo.com/map10.html
http://allmap.hostevo.com/map11.html
http://allmap.hostevo.com/map12.html
http://allmap.hostevo.com/map13.html
http://allmap.hostevo.com/map14.html
http://allmap.hostevo.com/map15.html
http://allmap.hostevo.com/map16.html
http://allmap.hostevo.com/map17.html
http://allmap.hostevo.com/map18.html
http://allmap.hostevo.com/map19.html
http://allmap.hostevo.com/map20.html
http://allmap.hostevo.com/map21.html
http://allmap.hostevo.com/map22.html
http://allmap.hostevo.com/map23.html
http://allmap.hostevo.com/map24.html
http://allmap.hostevo.com/map25.html
http://allmap.hostevo.com/map26.html
http://allmap.hostevo.com/map27.html
http://allmap.hostevo.com/map28.html
http://allmap.hostevo.com/map29.html
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229377#4229377
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229377
16 years, 11 months