100 likes | 289 Views
Application Development Best Practices. caGrid Knowledge Center February 2011. What best practices?. The Knowledge Center has identified a set of caGrid development best practices based upon the practices of the caGrid development team and 2.5 years of community support.
E N D
Application Development Best Practices caGrid Knowledge Center February 2011
What best practices? The Knowledge Center has identified a set of caGrid development best practices based upon the practices of the caGrid development team and 2.5 years of community support. Best practices subject areas: • caGrid Installation • Service Creation • Service Testing • Service Deployment • Service Operation
caGrid Installation Installation best practices • Install all packages installed by the caGrid installer into a single top-level directory, like ‘ext-1.3.0.2’. • Do not install into a path that contains a space, like ‘Documents and Settings”. • Set environment variables as specified by the Installer. • Do not deploy into the Globus container, use Tomcat or JBoss.
Service Creation Service creation best practices • Review your model more than once! Service creation is a waterfall process. If you find an error in your model after you create your service you will have to throw out the service and start again. • When possible, stick with the functionality provided by Introduce. • If you need to alter Introduce functionality, create an extension at one of the many extension points that are provided. Contribute the extension back as a Community Project. • If you need to change the functionality of a caGrid project for your service, create your own class that extends the caGrid class and package it into an appropriately named jar. • Configure your service to use transport layer security (encryption) and to require users to connect using a trusted, non-expired grid certificate. • Update the Introduce generated client class to connect to your service and perform some real functionality.
Service Creation (cont) Service creation best practices • Build your analytical service as an API first, then grid-ify it • This gives you a way to test your business logic in isolation • The API can be used without a grid service front end in tightly integrated applications
Service Testing Testing best practices • Write unit tests to: • Query each exposed object: entire object, selected attributes, by Id, associations with other objects, and with Query Modifiers (count, etc.). • Test every operation that you have added to the service • Test any custom serialization logic your data types use • Write integration tests to: • Deploy the service and invoke the client operations • Verify resources get created, persisted, and destroyed as they should • Use negative tests to: • Verify failure modes throw the correct exceptions • Make sure your code handles bad or unexpected input
Service Deployment Deployment best practices • Deploy into a container that was created by the caGrid Installer to avoid manual configuration errors. • Test that your container starts successfully before attempting to deploy and test your service. • Use a secure container. • One container per user. • One service deployed per container. • Verify that your service metadata specifies a responsible contact in the Hosting Research Center element. This helps the KC / NCI contact the service maintainer.
Service Operation Operation best practices • Monitor your service by URL and verify the presence of the “this is an AXIS service” text. • Use a monitoring tool that will notify the service maintainer when the service is not responding. (The Training Grid is monitored using Nagios) • Truncate your container logs! The Tomcat catalina.out file is not truncated by default. (The Training Grid hosts use logrotate) • Watch your CPU, RAM and Disk utilization to optimize them for your service.
Community Sharing • Share your code back with the community via downloadable zip or publicly accessible source repository. • Share your design and user documentation. • Publicize your project on the caGrid User Group Teleconference. • Create a Community Project.
Each caGrid project has a “Project Status” page containing compliance with our best practices.