Sunday, 20 November 2011

Grails + CXF Example - Contract First WSDL

There is an excellent tutorial for doing contract first WSDL with CXF in grails here:
http://docs.codehaus.org/pages/viewpage.action?pageId=85983334

After a bit of mucking about I managed to improve it slightly.

Still couldn't get the cxf simpleBean tag to allow injection of grails services - it works but the resultant service fails with errors like:


[Namespace] [method] was not recognized.  (Does it exist in service WSDL?)</faultstring></soap:Fault></soap:Body></soap:Envelope>"

I think this is because spring / grails is proxying the beans set up in resources.xml so the object passed to simpleServer does not have the annotation necessary to publish the webservice.  Found this:
http://www.techper.net/2009/12/03/cxf-method-not-found-when-further-annotated/

Anyway, the solution is to not use simpleServer and do it yourself in Bootstrap as follows:
1) Inject the grails service that implements the web service into bootstrap
2) start the web service in Bootstrap init:


        System.out.println("Starting Security WebService");
        Object implementor = injectedService
        String address = "/serviceAddress";
        Endpoint.publish(address, implementor);
    }



Thursday, 3 November 2011

Git Command - Including Deleting Remote Branch

Handy site to remember git commands:
http://gitref.org

The daddy of refs:
http://progit.org/book

A non obvious command to delete a remote branch.

First do git branch -d [branchName] locally
Then: git push origin :[branchName]

This is based on refspecs - doco for which is can be found here:
http://progit.org/book/ch9-5.html

Basically this is saying push an empty reference to [branchName] on the remote system.  That has the effect of deleting it.

Wednesday, 27 April 2011

Windows Memory Settings - Know When RAM Or Page File Is The Bottleneck

From http://support.microsoft.com/kb/2267427

Monitoring RAM and Virtual Memory usage
 
Performance Monitor  is the principle tool for monitoring system performance and identifying what the bottleneck really is. To start Performance Monitor, open Control Panel, clickPerformance Information and Tools, click Advanced Tools, and then click Open Performance Monitor.

The following is a summary of some important counters and what they tell you.
 
Memory, Committed Bytes: This is a measure of the demand for virtual memory. It shows how many bytes have been allocated by processes and to which the operating system has committed a RAM page frame or a page slot in the pagefile (or both). As Committed Bytes grows above the available RAM, paging increases, and the amount of the pagefile in use also increases. At some point, paging activity starts to significantly affect perceived performance.
 
Process, Working Set, _Total: This is a measure of the amount of virtual memory in "active" use. It shows how much RAM is required so that the actively used virtual memory for all processes is in RAM. This is always a multiple of 4,096, which is the page size used in Windows. As demand for virtual memory increases above the available RAM, the operating system adjusts the size of virtual memory in the Working Set for a process to optimize the use of available RAM and to minimize paging.
 
Paging File, %pagefile in use: This is a measure of how much of the pagefile is actually being used. This is the counter you should use to determine whether the pagefile is an appropriate size. If this counter reaches 100, the pagefile is completely full and operations stop working. Depending on the volatility of your workload, you probably want to set the pagefile large enough so that no more than 50 to 75 percent of it is used. If a large part of the pagefile is in use, having more than one pagefile on different physical disks may improve performance. 
 
Memory, Pages/Sec: This is one of the most misunderstood measures. A high value for this counter does not necessarily indicatey that your performance bottleneck is a shortage of RAM. The operating system uses the paging system for purposes other than for swapping pages due to memory over-commitment.
 
Memory, Pages Output/Sec: This shows how many virtual memory pages were written to the pagefile to free RAM page frames for other purposes each second. This is the best counter to monitor if you suspect that paging is your performance bottleneck. Even if the Committed Bytes value is greater than the installed RAM, a Pages Output/sec value that is low or zero most of the time indicates that there is not a significant performance problem that is caused by not enough RAM.
 
Memory, Cache Bytes
Memory, Pool Nonpaged Bytes
Memory, Pool Paged Bytes
Memory, System Code Total Bytes
Memory, System Driver Total Bytes

The sum of these counters is a measure of how much of the 2 GB of the shared part of the 4 GB virtual address space is actually in use. Use these counters to determine whether your system is reaching one of the architectural limits discussed above.
 
Memory, Available MBytes: This measures how much RAM is available to satisfy demands for virtual memory (either new allocations, or for restoring a page from the pagefile). When RAM is in short supply (for example, Committed Bytes is greater than installed RAM), the operating system tries  to keep a certain fraction of installed RAM available for immediate use by copying virtual memory pages that are not in active use to the pagefile. For this reason, this counter will not reach zero. Therefore, it is not necessarily a good indication of whether your system is short of RAM.

Sunday, 13 March 2011

Apoache Ab For Performace Tests

http://httpd.apache.org/docs/2.0/programs/ab.html

common script:

ab -c 50 -n 1000 -e "grails_list_test.csv" http://localhost:8080/benchmark/book/inzsertData?rows=100

Enabling JConsole JMX Remote Monitoring of Tomcat

1) Make sure your CATALINA_HOME environment variable is set to the home directory of your catalina installation

2) Create a file runCatalina.bat somewhere hat looks like:

@startlocal
SET JAVA_OPTS= -Dcom.sun.management.jmxremote
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8086
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
SET JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=256m -XX:MaxPermSize=256m
SET JAVA_OPTS=%JAVA_OPTS% -server -Xms1024m -Xmx1024m
%CATALINA_HOME%\bin\catalina run
endlocal

3) If running Vista check this out, and apply the bugfix:
http://marxsoftware.blogspot.com/2008/01/making-jps-and-jconsole-work-with-java.html

I.e. need to make sure that "Everybody" has appropriate permission on the folder that JConsole uses

4) Run Catalina

5) Run jconsole (in your %JAVA_HOME%\bin directory).

6) Connect to the tomcat instancer remotely using hostname and 8086 (as defined above)

Instructions on what JConsole output means:
http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/p1.html

WSUS and Group Policy

To force client to windows update via WSUS server
wuauclt /detectnow

To  force group policy to be applied
wpupdate /force

Word Useful

1) Alt f9 to toggle field codes.
2) field codes delimited by {}, but you have to menu Insert Field to get them in.
3) custom doc properties via {DocProperty "custom field name"}.

4) Margin height determines where the distinct part of the document starts and ends.  This fixes header and footer height.  Header and Footer determines how far from the edge of the document the header and the footer start.

5) For borders, you can set a point setting to change the distance between a border a and the text in the box