Using Ant to test Concurrency
Apache Ant is an awesome tool for creating batch builds, and doing all sorts of automated tasks. It was designed to replace make files, but you can use it for lots of things, as my example will show. Ant uses an XML language, with tasks (tags) to compile java classes, run java classes, manipulate the file system, create zip or tar.gz files, run SQL statements, XSL, FTP, etc. It also has an extensible API so there are tasks to do pretty much anything you would like to automate. We use ant at CFDEV to package our products into zip files, encrypt CFM templates, create multiple versions, and even upload the distribution files to our server - all in one step!
To get started check out the Ant Manual
One Ant task that I have found useful recently for testing concurrency is that
parallel task. It allows you to run several ant tasks within their own thread. I was using this to test some java code but you could also use it to test a web site.
Here's a code sample testing concurrent requests.
<?xml version='1.0'?> <project name="Concurrent" default="test" basedir="."> <target name="test"> <parallel> <get src="http://www.macromedia.com/" dest="1.html" /> <get src="http://www.macromedia.com/" dest="2.html" /> <get src="http://www.macromedia.com/" dest="3.html" /> <get src="http://www.macromedia.com/" dest="4.html" /> <get src="http://www.macromedia.com/" dest="5.html" /> </parallel> </target> </project>
Save the above contents in a file called
build.xml and run the file by browsing the directory you saved it in with your shell, and typing
ant (after installing ant ofcourse). You can add more concurrent threads just by adding more
- Why is my cron.daily script not running?
- Announcing FuseGuard Version 3
- CFSummit 2017
- Java Unlimited Strength Crypto Policy for Java 9 or 1.8.0_151
- Java 9 Security Enhancements
- Upcoming CFML Conferences in April 2017
- CFSummit 2016 Slides
- Securing Legacy CFML - dev.Objective() 2016 Slides