Skip to main content

Posts

Showing posts with the label playframework

Playframework vs Ruby On Rails

Yet another LanguageX vs LanguageY question.... Currently I have a bunch of apps built on playframework . For the most part I love it. Moving from PHP a few years ago was almost a religious experience -- an actual functional orm, much less boiler plate code, stuff just worked, etc. I still have a website running on a a shared hosting service thats built with PHP+ CodeIgniter . Recently I've been adding some features to this site and have been thinking about porting it to either Ruby on Rails or Playframework. So far though, nothing about rails has really blown me away. It seems like it has pretty much the same featureset as playframework. I like ruby's terseness, and things like blocks, but again for the most part there's been nothing about the language itself that has made me go "oh wow this is 1000x better than java/php/c/whatever!" In fact, some parts actually kind of rub me the wrong way -- I prefer strongly-typed languages for example. My questio

Why does java wait so long to run the garbage collector?

I am building a Java web app, using the Play! Framework . I'm hosting it on playapps.net . I have been puzzling for a while over the provided graphs of memory consumption. Here is a sample: The graph comes from a period of consistent but nominal activity. I did nothing to trigger the falloff in memory, so I presume this occurred because the garbage collector ran as it has almost reached its allowable memory consumption. My questions: Is it fair for me to assume that my application does not have a memory leak, as it appears that all the memory is correctly reclaimed by the garbage collector when it does run? (from the title) Why is java waiting until the last possible second to run the garbage collector? I am seeing significant performance degradation as the memory consumption grows to the top fourth of the graph. If my assertions above are correct, then how can I go about fixing this issue? The other posts I have read on SO seem opposed to calls to System.gc()

Render images by java code or read images from a static path?

Here's my code: 1.Java Code: public static void getImg(Long itemId) { try { Item item = Item.findById(itemId); if (item.img != null && item.img.getFile() != null{ response.setContentTypeIfNotSet(item.img.type()); renderBinary(item.img.get()); } } catch (Exception e) { Logger.error("Can't find image,itemId = " + itemId); } } html : < img src="@{{ Items.getImage(123)}}"/> 2. html : < img src="/public/images/123.jpg"/> I'm using playframework and the samples from documentation display images via the first version. What's the different (deep into mechanism) between them, especially in response performance ?