From: <Web...@St...> - 2004-07-20 08:40:48
|
On Mon, 19 Jul 2004, Sebastian Kanthak wrote: | On Monday 19 July 2004 18:39, Endre St=F8lsvik wrote: | > How about getting rid of the Threads, ALL of them?! BE GONE!!! | | hey, calm down :) ;) | | > I mean, WebMacro is a -library-. If I want it to use any cache manage= r | > that use threads, I'll start those myself, and kill them afterwards t= oo. | > Although I cannot understand what the good point about this would be:= why | > not use a WeakHashMap or other weak-style references for the cache? T= he | > default config and impl of the -library- WebMacro is, should most | > definately be -lean- and -mean-, not fire up any unhandled -threads-!= ! | > ( Not to mention that thread that updates a "time" long, I think it= was | > for logging: that must be the most .. useless .. piece of "performanc= e | > optimization" ever devised: in a production environment, how many | > log-lines are one to expect from WebMacro? The potential synchronizat= ion | > costs must be thousand-folds worse than the millis-getting, -if- ther= e was | > an impact in any way.. ) | | well. As you've perhaps noticed, Brian removed the clock thread in 2.0b= 1, so | no need to worry about it anymore. The only thread remaining is the one | responsible for removing templates from the cache after a given period = of | time and I'm afraid there is no other possibility than to do this with = a | thread. MAJOR POINT: Why do you have to remove the cached templates? See, this is my entire question. WHY do we have a Thread that removes the templates, this in particular in a production environment? Memory issues? If the templates were put into the cache using "soft references" .. http://java.sun.com/developer/technicalArticles/ALT/RefObj/index.html http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=3Dget_topic&= f=3D15&t=3D000179 .. then this would be the best for a production environment, by far. And you'd not need the Thread. The -even better- thing would be to have som "call-in" method into the Broker (or the thingy holding the cache) that I could invoke that says "clear all caches, please, completely". We wouldn't need the Thread!! The Thread is good in development setting, due to how the macro(-files) apparently are implemented. This because a macro-file won't be "reload-checked" at all, and thus will be stale forever - so I set the reload-time to 3 seconds while developing. But I'd prefer to switch cache= s on deployment, and use a Soft or Weak reference cache, that just loaded and loaded and loaded and used up -all- memory. See the comment #3 by "Member #862" in the above-mentioned javaranch-link= : "free memory is _bad_". The logic is that if you have 2 GBs of RAM (which isn't that uncommon), then why have to load -any- templates of disk? Why not just have them precompiled and ready to go -always-? The memory -will= - get freed when there isn't enough memory for the working set of normal activities. And Reading this: http://www.axlrosen.net/stuff/softreferences.html I realize that what I want is a -soft- reference cache, not a weak. Weak is .. weaker .. than soft! So soft-cache it is. | | BTW, the thread is started by a class in the concurrent package, anothe= r | _library_... ;) Well, another bad library! ;) Really, I don't like libraries that fire up Threads w/o me asking in particular for it. A program with millions of Threads, where each have on= e specific stupid little chore. OT, There should be some "cron"- and dispatch-based "TaskRunning" syste= m that was embedded "in the JVM" (read: standard java), in addition to a event-queue that one could inject events into, and subscribe listeners to= . (I have made these features as services within the portal-server our company makes, and developers actually use it and like it a lot.) And, btw, I do know that the concurrent package is very nice, but firing up Threads here and there and everywhere is really bad in my opinion, anywhichway - one immediately get such problems as we now face. | | However, one could add logic to only start this thread, if the function= ality | to remove templates from the cache after some time is actually used (e.= g. | ExpireTime is set to a positive value). YES! YES! YES!!! Ehh.. I'd love to see this functionality implemented.. ;) (As a first step) To solve my tomcat-reload-problem (if it really is WebMacro that doesn't clean its Threads on reload/redeploy) in development sceniarios, I could actually just use NO cache, if it is impossible to get the macro-thingys to "reload-check" also. | | > So WebMacro isn't cleaning up after itself? I've always had a problem= with | > my webapplication "leaking memory" when i restart it dozens of times, | > eating up my 64 MB "developer sized memory" for Tomcat after 10-12 | > restarts. So WebMacro is the one to blame? And it won't get better in= the | > next version either? | | 1.1final is stopping all threads and garbage collection should take car= e of | the rest, I think, but apparently something does not work (see Mark's | problem) completely. I have huge memory-leaking when reloading, as mentioned, but I have reall= y no idea to where this might be, but -have- been suspicious towards WebMacro due to the annoyance-Threads being fired up and .. hangin' out. | | > On a tangent: How's the next version coming along?! ;) | | well, at least we have some traffic on the list again. :) | | Regarding the next version: Do we have some functionality to make globa= l | "macro-libraries" available via WebMacro.properties, so that template a= uthors | do not need to include them in every template? If not, I'd like to add = this | functionality. I think that 2.0 should be shipped a year ago, approx. So, do not add mor= e functionality to it now, just get it out the door. Now, please, now! Add this kind of functionality to a 2.1 release. Thanks, Endre |