You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es> on 2012/05/11 13:18:24 UTC

Performance loss with MyFaces 2.1.7

Hello,

I've done a performance test comparing between versions of MyFaces 2.1.6 and 2.1.7. The result has been that version 2.1.7 has a worse performance, about 25% worse in requests per second and about 50% worse in response time. These data are obtained by doing load tests on a server until it reaches saturation (the CPU reaches a 90-100% usage).

Comparing with JProfiler two executions of these load tests, one with version 2.1.6 and one with version 2.1.7, we see clearly that the problem seems to be that the number of invocations of the method Thread.getContextClassLoader () has increased significantly (+300k invocations more) and has therefore increased the time in this method (+50 s).

This change comes from the solution to the bug MyFaces-3510 [1] where a change was made on _ComponentAttributesMap class.

Leonardo, what do you think about this?

Should I reopen the bug MyFaces-3510 or create a new bug?

[1] https://issues.apache.org/jira/browse/MYFACES-3510


Un saludo,

Jesús Pérez Alcaide
Lab. Banksphere - Runtime
Tlf:  91 470 5223



*********************AVISO LEGAL **********************
Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.

**********************DISCLAIMER*****************
This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors or omissions in the contents of this message after it has been sent.
This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.

Re: Performance loss with MyFaces 2.1.7

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I think the behavior you see is ok, and goes according to the design.

What is happening here is in the saturation point the memory gets
filled to a maximum point, so the gc tries to clear all soft
references before throw an OutOfMemoryException, and the change done
adds a soft reference wrapping this map, to prevent the app
classloader leak. But this map is uses very often and each request
force to create it again, so at the end in this point it will be
obviously a slowdown. But it is completely reasonable, because the
test is designed for that.

regards

Leonardo

2012/5/11 PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es>:
> Hello,
>
>
>
> I've done a performance test comparing between versions of MyFaces 2.1.6 and
> 2.1.7. The result has been that version 2.1.7 has a worse performance, about
> 25% worse in requests per second and about 50% worse in response time. These
> data are obtained by doing load tests on a server until
> it reaches saturation (the CPU reaches a 90-100% usage).
>
>
>
> Comparing with JProfiler two executions of these load tests, one with
> version 2.1.6 and one with version 2.1.7, we see clearly that the
> problem seems to be that the number of invocations of
> the method Thread.getContextClassLoader () has
> increased significantly (+300k invocations more) and has therefore increased
> the time in this method (+50 s).
>
>
>
> This change comes from the solution to the bug MyFaces-3510 [1] where a
> change was made on _ComponentAttributesMap class.
>
>
>
> Leonardo, what do you think about this?
>
>
>
> Should I reopen the bug MyFaces-3510 or create a new bug?
>
>
>
> [1] https://issues.apache.org/jira/browse/MYFACES-3510
>
>
>
>
>
> Un saludo,
>
>
>
> Jesús Pérez Alcaide
>
> Lab. Banksphere - Runtime
>
> Tlf:  91 470 5223
>
>
>
>
>
>
> *********************AVISO LEGAL **********************
> Este mensaje es privado y confidencial y solamente para la persona a la que
> va dirigido. Si usted ha recibido este mensaje por error, no debe revelar,
> copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al
> remitente y borre dicho mensaje y cualquier documento adjunto que pudiera
> contener. No hay renuncia a la confidencialidad ni a ningún privilegio por
> causa de transmisión errónea o mal funcionamiento.
> Cualquier opinión expresada en este mensaje pertenece únicamente al autor
> remitente, y no representa necesariamente la opinión de ISBAN, a no ser que
> expresamente se diga y el remitente esté autorizado para hacerlo.
> Los correos electrónicos no son seguros, no garantizan la confidencialidad
> ni la correcta recepción de los mismos, dado que pueden ser interceptados,
> manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN
> no se hace responsable de los cambios, alteraciones, errores u omisiones que
> pudieran hacerse al mensaje una vez enviado.
> Este mensaje sólo tiene una finalidad de información, y no debe
> interpretarse como una oferta de venta o de compra de valores ni de
> instrumentos financieros relacionados.
>
> **********************DISCLAIMER*****************
> This message is private and confidential and it is intended exclusively for
> the addressee. If you receive this message by mistake, you should not
> disseminate, distribute or copy this e-mail. Please inform the sender and
> delete the message and attachments from your system. No confidentiality nor
> any privilege regarding the information is waived or lost by any
> mistransmission or malfunction.
> Any views or opinions contained in this message are solely those of the
> author, and do not necessarily represent those of ISBAN, unless otherwise
> specifically stated and the sender is authorized to do so.
> E-mail transmission cannot be guaranteed to be secure, confidential, or
> error-free, as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. ISBAN does not accept
> responsibility for any changes, errors or omissions in the contents of this
> message after it has been sent.
> This message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.

RE: Performance loss with MyFaces 2.1.7

Posted by PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es>.
Hello,

I think this is caused by the solution made for bug MYFACES-3262 [1]. In this bug, it was found that there is a concurrency problem because methods getReadMethod() and getWriteMethod() of class java.beans.PropertyDescriptor are synchronized.

To fix this, _PropertyDescriptorHolder class was created to avoid calls to the synchronized methods by caching read and write methods. But as it did, it kept a strong reference to instances of Method, which in turn has a strong reference to the Class and this to its ClassLoader.

All of this caused the ClassLoader of an application can not be collected when it stops, as indicated in the bug MYFACES-3510 [2]. To solve this second bug, an additional cache was introduced using as key the ClassLoader. This cache would be cleaned when the web application is stopped.

But this cache, results in the loss of performance that I said.

Therefore, I would like to propose an alternative solution to bugs MYFACES-3262 and MYFACES-3510, which consists in rollback the changes made in MYFACES-3510 and modify the solution given in MYFACES-3262 by adding a soft reference to the methods held in the class _PropertyDescriptorHolder.

I repeated my performance tests with these changes applied and the result is that the version 2.1.7 already performs as well as version 2.1.6 (in fact, it performs a little better).

I will create an issue for these changes.

[1] https://issues.apache.org/jira/browse/MYFACES-3262
[2] https://issues.apache.org/jira/browse/MYFACES-3510


Un saludo,

Jesús Pérez Alcaide
Lab. Banksphere - Runtime
Tlf:  91 470 5223


-----Mensaje original-----
De: Leonardo Uribe [mailto:lu4242@gmail.com]
Enviado el: sábado, 12 de mayo de 2012 15:43
Para: MyFaces Development
CC: MARTIN POZO RUBEN
Asunto: Re: Performance loss with MyFaces 2.1.7

Hi

Just to keep it clear: MyFaces Core 2.1.7 in a typical situation is a
lot faster than 2.1.6, which suppose a server that are working with
enough memory to deal with the load. The effect described here is
reasonable, and compared with the app classloader mem leak already
solved it is ok let the code as is. A hack to prevent it, is overkill.
Instead, the application must be tuned to use the right scopes (JSF
View Scope or MyFaces CODI window scope or conversation scope), to
prevent hold many beans on the session when it is not necessary, and
in that way increase the memory available.

regards,

Leonardo Uribe

2012/5/11 Mark Struberg <st...@yahoo.de>:
>
>
> Hi!
>
> Please open a new bug and link it to the original one as follow up.
>
>
> The funny thing is that this effect doesn't show up in all scenarios. I measured a pretty good performance improvement from 2.1.6 to 2.1.7 in my app.
>
> Are the pages in your app rather small or big?
>
>
> txs and LieGrue,
> strub
>
>
>>________________________________
>> From: PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es>
>>To: MyFaces Development <de...@myfaces.apache.org>
>>Cc: MARTIN POZO RUBEN <rm...@isban.es>
>>Sent: Friday, May 11, 2012 1:18 PM
>>Subject: Performance loss with MyFaces 2.1.7
>>
>>
>>
>>Hello,
>>
>>I've done a performance test comparing between versions of MyFaces 2.1.6 and 2.1.7. The result has been that version 2.1.7 has a worse performance, about 25% worse in requests per second and about 50% worse in response time. These data are obtained by doing load tests on a server until it reaches saturation (the CPU reaches a 90-100% usage).
>>
>>Comparing with JProfiler two executions of these load tests, one with version 2.1.6 and one with version 2.1.7, we see clearly that the problem seems to be that the number of invocations of the method Thread.getContextClassLoader () has increased significantly (+300k invocations more) and has therefore increased the time in this method (+50 s).
>>
>>This change comes from the solution to the bug MyFaces-3510 [1] where a change was made on _ComponentAttributesMap class.
>>
>>Leonardo, what do you think about this?
>>
>>Should I reopen the bug MyFaces-3510 or create a new bug?
>>
>>[1] https://issues.apache.org/jira/browse/MYFACES-3510
>>
>>
>>Un saludo,
>>
>>Jesús Pérez Alcaide
>>Lab. Banksphere - Runtime
>>Tlf:  91 470 5223
>>
>>
>>*********************AVISO LEGAL **********************
>>Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje
> y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
>>Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
>>Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los
> cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
>>Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.
>>
>>**********************DISCLAIMER*****************
>>This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from
> your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
>>Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
>>E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors
> or omissions in the contents of this message after it has been sent.
>>This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
>>
>>
>>

*********************AVISO LEGAL **********************
Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.

**********************DISCLAIMER*****************
This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors or omissions in the contents of this message after it has been sent.
This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.

Re: Performance loss with MyFaces 2.1.7

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

Just to keep it clear: MyFaces Core 2.1.7 in a typical situation is a
lot faster than 2.1.6, which suppose a server that are working with
enough memory to deal with the load. The effect described here is
reasonable, and compared with the app classloader mem leak already
solved it is ok let the code as is. A hack to prevent it, is overkill.
Instead, the application must be tuned to use the right scopes (JSF
View Scope or MyFaces CODI window scope or conversation scope), to
prevent hold many beans on the session when it is not necessary, and
in that way increase the memory available.

regards,

Leonardo Uribe

2012/5/11 Mark Struberg <st...@yahoo.de>:
>
>
> Hi!
>
> Please open a new bug and link it to the original one as follow up.
>
>
> The funny thing is that this effect doesn't show up in all scenarios. I measured a pretty good performance improvement from 2.1.6 to 2.1.7 in my app.
>
> Are the pages in your app rather small or big?
>
>
> txs and LieGrue,
> strub
>
>
>>________________________________
>> From: PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es>
>>To: MyFaces Development <de...@myfaces.apache.org>
>>Cc: MARTIN POZO RUBEN <rm...@isban.es>
>>Sent: Friday, May 11, 2012 1:18 PM
>>Subject: Performance loss with MyFaces 2.1.7
>>
>>
>>
>>Hello,
>>
>>I've done a performance test comparing between versions of MyFaces 2.1.6 and 2.1.7. The result has been that version 2.1.7 has a worse performance, about 25% worse in requests per second and about 50% worse in response time. These data are obtained by doing load tests on a server until it reaches saturation (the CPU reaches a 90-100% usage).
>>
>>Comparing with JProfiler two executions of these load tests, one with version 2.1.6 and one with version 2.1.7, we see clearly that the problem seems to be that the number of invocations of the method Thread.getContextClassLoader () has increased significantly (+300k invocations more) and has therefore increased the time in this method (+50 s).
>>
>>This change comes from the solution to the bug MyFaces-3510 [1] where a change was made on _ComponentAttributesMap class.
>>
>>Leonardo, what do you think about this?
>>
>>Should I reopen the bug MyFaces-3510 or create a new bug?
>>
>>[1] https://issues.apache.org/jira/browse/MYFACES-3510
>>
>>
>>Un saludo,
>>
>>Jesús Pérez Alcaide
>>Lab. Banksphere - Runtime
>>Tlf:  91 470 5223
>>
>>
>>*********************AVISO LEGAL **********************
>>Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje
> y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
>>Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
>>Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los
> cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
>>Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.
>>
>>**********************DISCLAIMER*****************
>>This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from
> your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
>>Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
>>E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors
> or omissions in the contents of this message after it has been sent.
>>This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
>>
>>
>>

Re: Performance loss with MyFaces 2.1.7

Posted by Mark Struberg <st...@yahoo.de>.

Hi!

Please open a new bug and link it to the original one as follow up.


The funny thing is that this effect doesn't show up in all scenarios. I measured a pretty good performance improvement from 2.1.6 to 2.1.7 in my app.

Are the pages in your app rather small or big?


txs and LieGrue,
strub


>________________________________
> From: PEREZ ALCAIDE JESUS <jp...@servexternos.isban.es>
>To: MyFaces Development <de...@myfaces.apache.org> 
>Cc: MARTIN POZO RUBEN <rm...@isban.es> 
>Sent: Friday, May 11, 2012 1:18 PM
>Subject: Performance loss with MyFaces 2.1.7
> 
>
> 
>Hello,
> 
>I've done a performance test comparing between versions of MyFaces 2.1.6 and 2.1.7. The result has been that version 2.1.7 has a worse performance, about 25% worse in requests per second and about 50% worse in response time. These data are obtained by doing load tests on a server until it reaches saturation (the CPU reaches a 90-100% usage).
> 
>Comparing with JProfiler two executions of these load tests, one with version 2.1.6 and one with version 2.1.7, we see clearly that the problem seems to be that the number of invocations of the method Thread.getContextClassLoader () has increased significantly (+300k invocations more) and has therefore increased the time in this method (+50 s).
> 
>This change comes from the solution to the bug MyFaces-3510 [1] where a change was made on _ComponentAttributesMap class.
> 
>Leonardo, what do you think about this?
> 
>Should I reopen the bug MyFaces-3510 or create a new bug?
> 
>[1] https://issues.apache.org/jira/browse/MYFACES-3510
> 
> 
>Un saludo,
> 
>Jesús Pérez Alcaide
>Lab. Banksphere - Runtime
>Tlf:  91 470 5223
> 
> 
>*********************AVISO LEGAL **********************
>Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje
y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento.
>Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de ISBAN, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo.
>Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no se hace responsable de los
cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.
>Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados.
>
>**********************DISCLAIMER*****************
>This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and attachments from
your system. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.
>Any views or opinions contained in this message are solely those of the author, and do not necessarily represent those of ISBAN, unless otherwise specifically stated and the sender is authorized to do so.
>E-mail transmission cannot be guaranteed to be secure, confidential, or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. ISBAN does not accept responsibility for any changes, errors
or omissions in the contents of this message after it has been sent.
>This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
> 
>
>