GHads mind

developers thoughts & finds

Archive for the ‘Uncategorized’ Category

Disable Gaelyk reloading routes on every Request in DEV mode

leave a comment »

I’m working on a little client/server app with C# WPF 4.5 as frontend and Gaelyk on Google App Engine (GAE) as server backend. While testing the load of my app on development server, I discovered a high single core load on my server and a very bad response time once the requests per second was higher than around 10.

After some testing hours I found that Gaelyk reloades the routes.config file on every request to check for changes as I didn’t have timestamps on my filesystem or I did not start with admin rights. Anyway instead of checking if the file has changed, the RoutesFilter always creates a new GroovyShell and runs the routes.config as script, thus compiling it which in turn resulted in a high single core load and a bad request time. As you can imagine constant recompiling stresses the server and I observed a delay of 150ms per request just for reevaluating the routes.config file on every request. Wow, that sums up quickly.

Well, in production mode this will not be done and on deveploment mode this is normaly not a problem but in my case I have many users that query the server once a second and the check for file modification is not working.

But as I do not change the routes often (and if I will just have to restart Gaelyk) I looked around how to disable this behaviour and discovered you can configure your own route filter in web.xml

    <!-- Use custom routes filter to disable reloading of routes.config for every request for development server -->
    <filter>
        <filter-name>RoutesFilter</filter-name>
        <filter-class>utils.NoReloadRoutesFilter</filter-class>
    </filter>

Then just extend the RouteFilter class:

package utils

import groovyx.gaelyk.routes.RoutesFilter;

class NoReloadRoutesFilter extends RoutesFilter 
{
	private boolean init = false
	
	@Override
	synchronized void loadRoutes() {
		if (!init) 
		{
			 init = true
			 super.loadRoutes()
		}
	}
}

That’s it. It may be an uncommen problem but it was a problem for me 🙂

Greetings,
GHad

Advertisements

Written by ghads

November 15, 2013 at 6:50 pm

Posted in Uncategorized

Tagged with , , , ,

I really need to…

leave a comment »

…start blogging again. Sorry for being so silent, it’s hard work out there and no time left for a little posting fun… That said I’ll try to blog some new and intresting things in the next couple of month. Beside still programing Groovy/Java/JavaScipt mainly I’m into Gaelyk (GAE) and C# lately so expect some new hot topics…

Greetings,

GHad

Written by ghads

August 19, 2013 at 3:11 pm

Posted in Scrap, Uncategorized

Tagged with

Chrome 10 javascript trap with variable named ‘performance’

leave a comment »

Just a quick reminder.

Don’t name any of your own javascript variables ‘performance’. Chrome uses this variable internally for its developers toolbox. I used it to measure my own performance metrics which worked perfectly in any other browser, but testing Chrome 10 revealed strange results. In the end I discovered that Chrome 10 used it for its own measurements which made my efforts useless, at least the way I wanted to use the variable.

Greetz,
GHad

Written by ghads

March 25, 2011 at 11:02 am

Happy new year 2011!

leave a comment »

I wish you a good start and an even better year 2011!

I hope to blog more regulary this year with various themes and interesting topics. So stay tuned…

Greetz, GHad

Written by ghads

January 3, 2011 at 10:30 am

Posted in Uncategorized

Tagged with