From: François-Xavier B. <fra...@ce...> - 2012-03-22 09:59:52
|
Hi, * Forcing queries to run one after another will be too slow, you don't know in advance if a resource is cacheable or not so if you have a page from a CMS that takes 1 s and you run queries on after another, it isnot good. * Returning an old object while it is being refreshed is a very good idea, but you cannot do that in all cases for example when the server uses different Etag header value for different versions of the same resource and only the server can decide which resource to serve to the client (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26). Anyway the idea is good and can probably improve a lot the performances for static resources, you just have to study under which conditions this rule can be applied. * Copying and replacing the HashMap / TreeSet is probably the most simple and secure solution to our current problem with almost no impact on performance. Francois-Xavier Le 21/03/2012 18:32, Nicolas Richeton a écrit : > Synchronizing slows down performance unit test which fails. > We are still investigating this solution. > > But I think that rather solving concurrent calls to this hashmap, we may prevent these call somewhere higher in the code : > > If several thread are updating the same cached response, this means that we have launched at the same time several update queries for the SAME content (url+headers). > > We may : > - force queries to run one after another. > - return an old object while it is being updated. > - copy& replace hashmap / treeset instead of updating them. > > Nicolas > > Le 21 mars 2012 à 16:14, Juigne, Stephane a écrit : > >> That's exactly the fix I did, but for now test fails, I'm still investigating.... >> >> Regards >> >> -----Message d'origine----- >> De : Nicolas Richeton [mailto:nic...@gm...] >> Envoyé : mercredi 21 mars 2012 16:13 >> À : web...@li... >> Objet : Re: Webassembletool-devel Digest, Vol 2, Issue 4 >> >> Sure, I'm sending this to Stephane (watstf) so he can make the fix and send the pached package to performance environment. >> Stéphane, be sure to register to -devel list so you can reply directly :-) >> >> Nicolas >> >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Wed, 21 Mar 2012 15:23:58 +0100 >>> From: Fran?ois-Xavier Bonnet <fra...@ce...> >>> Subject: Re: [EsiGate-devel] Thread locked under load >>> To: web...@li... >>> Message-ID:<4F6...@ce...> >>> Content-Type: text/plain; charset="iso-8859-1" >>> >>> OK, so we should wrap the TreeSet and HashMap used in Output class using >>> Collections.synchronizedSortedSet(...) and Collections.synchronizedMap(...) >>> Nicolas, can you check that it fixes the problem ? >>> >>> Le 21/03/2012 15:10, Alexis Thaveau a ?crit : >>>> http://java.dzone.com/articles/concurrency-and-hashmap >>>> >>>> Le 21/03/2012 15:08, Alexis Thaveau a ?crit : >>>>> The main bug is that headers.put is called by several threads at same >>>>> time. As you said, thread are still runnable, i think map is broken, >>>>> and result is a kind of infinite loop. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Le 21/03/2012 14:53, Fran?ois-Xavier Bonnet a ?crit : >>>>>> This is a real problem but do you think it can explain the 100% CPU ? >>>>>> Shouldn't we have some ConcurrentModificationException ? >>>>>> Cordialement, >>>>>> >>>>>> Fran?ois-Xavier Bonnet >>>>>> Responsable de production >>>>>> Smile - Open Source Solutions >>>>>> www.smile.fr >>>>>> T?l : +33 1 41 40 59 28 >>>>>> Fax : +33 1 47 30 25 61 >>>>>> GSM : +33 6 17 45 19 08 >>>>>> >>>>>> Le 21/03/2012 11:52, Alexis Thaveau a ?crit : >>>>>>> Hi, >>>>>>> >>>>>>> Implementation of TreeSet is not synchronized => not thread safe. >>>>>>> http://docs.oracle.com/javase/6/docs/api/java/util/TreeSet.html >>>>>>> TreeSet must be wrapped with Collections.synchronizedSortedSet || >>>>>>> <http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#synchronizedSortedSet%28java.util.SortedSet%29> >>>>>>> >>>>>>> >>>>>>> Le 21/03/2012 11:44, Nicolas Richeton a ?crit : >>>>>>>> Hi all >>>>>>>> >>>>>>>> We have an issue with with ESIGate 2.19 under load, resulting to 100% cpu usage and lock. >>>>>>>> >>>>>>>> Please have a look to : >>>>>>>> http://sourceforge.net/apps/mantisbt/webassembletool/view.php?id=84 >>>>>>>> >>>>>>>> We have the setup show the issue, but not easy to test. Problem arises after several hours. >>>>>>>> >>>>>>>> This seems to be linked to the new cache system because older versions of ESIGate did not show any locking under heavy load. >>>>>>>> >>>>>>>> Andreii : any idea/comments on this issue ? >>>>>>>> >>>>>>>> Nicolas >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> This SF email is sponsosred by: >>>>>>>> Try Windows Azure free for 90 days Click Here >>>>>>>> http://p.sf.net/sfu/sfd2d-msazure >>>>>>>> _______________________________________________ >>>>>>>> Webassembletool-devel mailing list >>>>>>>> Web...@li... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/webassembletool-devel >>>>>>> >>>>>>> -- >>>>>>> Alexis Thaveau >>>>>>> Agence Nantes >>>>>>> Smile - Open Source Solutions >>>>>>> http://www.smile.fr >>>>>>> T?l : 02 40 08 68 10 >>>>>>> Mailto :ale...@sm... >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> This SF email is sponsosred by: >>>>>>> Try Windows Azure free for 90 days Click Here >>>>>>> http://p.sf.net/sfu/sfd2d-msazure >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Webassembletool-devel mailing list >>>>>>> Web...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/webassembletool-devel >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> This SF email is sponsosred by: >>>>>> Try Windows Azure free for 90 days Click Here >>>>>> http://p.sf.net/sfu/sfd2d-msazure >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Webassembletool-devel mailing list >>>>>> Web...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/webassembletool-devel >>>>> >>>>> -- >>>>> Alexis Thaveau >>>>> Agence Nantes >>>>> Smile - Open Source Solutions >>>>> http://www.smile.fr >>>>> T?l : 02 40 08 68 10 >>>>> Mailto :ale...@sm... >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> This SF email is sponsosred by: >>>>> Try Windows Azure free for 90 days Click Here >>>>> http://p.sf.net/sfu/sfd2d-msazure >>>>> >>>>> >>>>> _______________________________________________ >>>>> Webassembletool-devel mailing list >>>>> Web...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/webassembletool-devel >>>> >>>> -- >>>> Alexis Thaveau >>>> Agence Nantes >>>> Smile - Open Source Solutions >>>> http://www.smile.fr >>>> T?l : 02 40 08 68 10 >>>> Mailto :ale...@sm... >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> This SF email is sponsosred by: >>>> Try Windows Azure free for 90 days Click Here >>>> http://p.sf.net/sfu/sfd2d-msazure >>>> >>>> >>>> _______________________________________________ >>>> Webassembletool-devel mailing list >>>> Web...@li... >>>> https://lists.sourceforge.net/lists/listinfo/webassembletool-devel >> >> >> >> >> >> >> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is >> intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to >> read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message >> in error, please notify the sender immediately and delete all copies of this message. >> > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Webassembletool-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webassembletool-devel |