<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div style=""><br><div>Anfang der weitergeleiteten Nachricht:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Von: </b></span><span style="font-family:'Helvetica';">Radoslaw Rodak &lt;<a href="mailto:rodakr@gmx.ch">rodakr@gmx.ch</a>&gt;<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Betreff: </b></span><span style="font-family:'Helvetica';"><b>Aw: [wildfly-dev] Pooling EJB Session Beans per default</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Datum: </b></span><span style="font-family:'Helvetica';">6. August 2014 19:20:07 MESZ<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>An: </b></span><span style="font-family:'Helvetica';">Bill Burke &lt;<a href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;<br></span></div><br><div><br>Am 06.08.2014 um 17:30 schrieb Bill Burke &lt;<a href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;:<br><br><blockquote type="cite"><br><br>On 8/6/2014 10:50 AM, Andrig Miller wrote:<br><blockquote type="cite"><br><br>----- Original Message -----<br><blockquote type="cite">From: "Radoslaw Rodak" &lt;<a href="mailto:rodakr@gmx.ch">rodakr@gmx.ch</a>&gt;<br>To: <a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>Sent: Tuesday, August 5, 2014 6:51:03 PM<br>Subject: Re: [wildfly-dev] Pooling EJB Session Beans per default<br><br><br>Am 06.08.2014 um 00:36 schrieb Bill Burke &lt;<a href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;:<br><br><blockquote type="cite"><br><br>On 8/5/2014 3:54 PM, Andrig Miller wrote:<br><blockquote type="cite"><blockquote type="cite">Its a horrible theory. :) &nbsp;How many EJB instances of a give type<br>are<br>created per request? &nbsp;Generally only 1. &nbsp;1 instance of one object<br>of<br>one<br>type! &nbsp;My $5 bet is that if you went into EJB code and started<br>counting<br>how many object allocations were made per request, you'd lose<br>count<br>very<br>quickly. &nbsp;&nbsp;Better yet, run a single remote EJB request through a<br>perf<br>tool and let it count the number of allocations for you. &nbsp;It will<br>be<br>greater than 1. &nbsp;:)<br><br>Maybe the StrictMaxPool has an effect on performance because it<br>creates<br>a global synchronization bottleneck. &nbsp;Throughput is less and you<br>end<br>up<br>having less concurrent per-request objects being allocated and<br>GC'd.<br><br></blockquote><br>The number per request, while relevant is only part of the story.<br> The number of concurrent requests happening in the server<br>dictates the object allocation rate. &nbsp;Given enough concurrency,<br>even a very small number of object allocations per request can<br>create an object allocation rate that can no longer be sustained.<br><br></blockquote><br>I'm saying that the number of concurrent requests might not dictate<br>object allocation rate. &nbsp;There are probably a number of allocations<br>that<br>happen after the EJB instance is obtained. &nbsp;i.e. interception<br>chains,<br>contexts, etc. &nbsp;&nbsp;If StrictMaxPool blocks until a new instance is<br>available, then there would be less allocations per request as<br>blocking<br>threads would be serialized.<br><br></blockquote><br>Scenarion 1 )<br>------------------<br>Let say we have a pool of 100 Stateless EJBs and a constant Load of<br> 50 Requests per second &nbsp;proceeded by 50 EJBs from the pool in one<br>second.<br>After 1000 seconds how many new EJB Instances will be created having<br>a pool? answer 0 new EJBs &nbsp;worst case 100 EJB’s in pool… of course<br>object allocation is much higher as of course 1 EJB call leads to<br>many Object from one EJB &nbsp;but…let see situation without pool.<br><br>50 Request/s * 1000 seconds = worst case 50’ 000 EJB Instances on<br>Java heap where 1 EJB might have many objects… &nbsp;&nbsp;as long as Garbage<br>Collection was not triggered… which sounds to me like faster filling<br>JVM heap and having ofter GC probable depending on GC Strategy.<br><br>Scenarion 2)<br>------------------<br>Same as before, &nbsp;Load is still 50 Requests &nbsp;per second BUT EJB Method<br>call takes 10s.<br>after 10s we have 500 EJB Instances without pool, after 11s &nbsp;550 - 10<br>= 540EJB Instances , after 12s &nbsp;580 EJBs … after some time very bad<br>perf…full GC …and mabe OutOfMemory..<br><br>So… performance advantage could also turn in to disadvantage :-)<br><br><br><blockquote type="cite">Whoever is investigating StrictMaxPool, or EJB pooling in general<br>should<br>stop. &nbsp;Its pointless.<br></blockquote><br>Agree, pools are outdated…. but something like WorkManager for min,<br>max Threads or even better always not less the X idle Threads would<br>be useful :-)<br><br>Radek<br><br></blockquote><br>The scenarios above are what is outddated. &nbsp;Fifty requests per second isn't any load at all! &nbsp;We have 100's of thousands of clients that we have to scale to, and lots more than 50 requests per second.<br><br></blockquote>What you mean to say is that you need to scale to 100's of thousands of <br>clients on meaningless no-op benchmarks. :) &nbsp;I do know that that old <br>SpecJ Java EE benchmarks artifically made EJB pooling important as <br>process intensive calculation results were cached in these instances. <br>But real-world apps don't use this feature/anti-pattern.<br><br>Also however crappy it was, I did implement an EJB container at one time <br>in my career. &nbsp;:) &nbsp;I know for a fact that there are a number of <br>per-request internal support objects that need to be allocated. &nbsp;Let's <br>count:<br><br>* The argument array (for reflection)<br>* Each argument of the method call<br>* The response object<br>* Interceptor context object<br>* The interceptor context attribute map<br>* EJBContext<br>* Subject, Principal, role mappings<br>* Transaction context<br>* The message object(s) specific to the remote EJB protocol<br><br>Starts to add up huh? &nbsp;&nbsp;I'm probably missing a bunch more. &nbsp;Throw in <br>interaction with JPA and you end up with even more per-request objects <br>being allocated. &nbsp;You still believe pooling one EJB instance matters?<br><br>-- <br>Bill Burke<br>JBoss, a division of Red Hat<br><a href="http://bill.burkecentral.com">http://bill.burkecentral.com</a><br>_______________________________________________<br>wildfly-dev mailing list<br>wildfly-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/wildfly-dev<br></blockquote><br>Totally agree!<br>The point is, pool has not only pool but also throttling function.<br>If you remove pool you still need throttling and you might have better performance over time with throttling as without and run out of resources...<br><br></div></blockquote></div><br></body></html>