Freitag, 4. Januar 2013

New year new IDE, start using Intellij 12

After one week of to start learning the Russian language on a Volkshochschule it's time to start using a new IDE: Intellij12.
One reason is to use same IDE as most of my colleagues which makes pair programming much easier. 
For my work normally I need a good Java/Groovy/SQL/Web-IDE with good refactoring support - that's the other reason to use Intellij - the excellent refactoring support.

Problem with groovy script in project paths...

One bigger issue I have is using Groovy script but not for the main build, only as helper for migration stuff etc.
So without any specific configuration I run into this compile conflict:

Groovyc: Exception in thread "main" java.lang.NoClassDefFoundError: groovy/lang/GroovyResourceLoader
   at java.lang.Class.getDeclaredMethods0(Native Method)
   at java.lang.Class.privateGetDeclaredMethods(
   at java.lang.Class.getMethod0(
   at java.lang.Class.getMethod(
   at com.intellij.rt.execution.CommandLineWrapper.main(
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyResourceLoader
   at Method)
   at java.lang.ClassLoader.loadClass(
   at java.lang.ClassLoader.loadClass(
   ... 5 more

This should by solved by disabling the the Compiler on external builds, see:

Besides this I add the groovy libs here:
"PlatformSettings->Global Libraries"
"+" and add: $groovy_home/lib/*

Sonntag, 18. November 2012

Link static content using spring MVC (e.g. favicon, apple toch icon, robots.txt etc.)

Spring MVC supports a "bypass" for static files, named resources. This is useful for accessing resources like favicon or static robots.txt.

Here is a little example spring config:

<beans xmlns=""
    xmlns:xsi=""  xmlns:mvc=""

    <mvc:resources mapping="/favicon.ico" location="/static/favicon.ico"  cache-period="43200"/>
    <mvc:resources mapping="/apple-touch-icon-precomposed.png" location="/static/apple-touch-icon-precomposed.png"  cache-period="43200"/>
    <mvc:resources mapping="/robots.txt" location="/static/robots.txt"  cache-period="43200"/>


see also:

Freitag, 9. November 2012

NonGUI JMeter test with properties values and log output

We need JMeter test for check some newer software release of our search backend.

To run that like in production we run it in production...

To adapt environment specific properties within the test plan we use Java system properties.

Step 1

Therefore we specifiy a new thread group and use our tomcat access logs which will parsed by JMeter "Access Log Sampler" (Parser: TCLogParser).
To adapt prod specific properties, we use JMeter properties featuere and set:
Server:  ${__P(solrserver)}
Port:      ${__P(solrport)}
LogFile: ${__P(logfile)}

Step 2

We copy the jmx File to our prod server which runs the tests.
 and start them via:

jmeter -n -Dsolrserver=localhost -Dsolrport=11011 -Dlogfile=/var/log/tomcat-server/solr21-1/access-2012-11-06.log -l log.jtl -j jm.log -t TestPlan.jmx -Dsummariser.out=true -Dsummariser.interval=4

The "Summariser" params leads to log some output to console window, like here:

summary +    510 in     7s =   73.3/s Avg:    72 Min:     0 Max:   874 Err:     0 (0.00%) Active: 6 Started: 6 Finished: 0
summary = 109375 in   752s =  145.4/s Avg:    40 Min:     0 Max:  1946 Err:   420 (0.38%)
summary +    420 in   6.2s =   67.6/s Avg:    83 Min:     1 Max:   878 Err:     0 (0.00%) Active: 6 Started: 6 Finished: 0

see also:

Samstag, 3. November 2012

extend ping (use timestamp and specific output) to detect network problems

Currently in production our application error logs show some strange peaks three times a day: a lot of unexpected socket timeouts. To check the network latency whithin a 24 hours time interval I need to extend the ping, with timestamp and write out the results in a log file.

The following example pings for 24 hours an "api-1"-called server and writes the results with an timestamp in a log file:

ping -i 5 -c 17280 -s 2560 api-1 | while read res; do echo "$(date "+%y-%m-%d %H:%M:%S") $res"; done >> ping.log &

'-i' the ping interval, we set to 5 seconds
'-c' the count of ping, we use 17280 x 5seconds = 1day
'-s' size of packets, we use 2560 bytes

{#less ping.log}
12-11-03 11:22:38 2650 bytes from api-1 (#.46.7.1): icmp_seq=37 ttl=62 time=16.3 ms
12-11-03 11:22:43 2650 bytes from api-1 (#.46.7.1): icmp_seq=38 ttl=62 time=16.2 ms
12-11-03 11:22:48 2650 bytes from api-1 (#.46.7.1): icmp_seq=39 ttl=62 time=16.2 ms
12-11-03 11:22:53 2650 bytes from api-1 (#.46.7.1): icmp_seq=40 ttl=62 time=16.3 ms
12-11-03 11:22:58 2650 bytes from api-1 (#.46.7.1): icmp_seq=41 ttl=62 time=16.2 ms
{/#less ping.log}