December 21st, 2007
Another reason that performance and load testing don’t get much attention is that they’re honestly hard to do. While there are many tools on the market, both free and commercial, it’s not always easy to use these tools to detect problems. The tools must be able to simulate many simultaneous users of a system, but that involves understanding what virtual users are,[2] what the different threading models are, and how they affect performance and load. Also, you must be able to look at the results and determine whether or not they are acceptable. All of this can be overwhelming to the average developer. This is part of what keeps developers from conducting the tests; they just don’t understand the necessary steps, or how and where to get started. Many organizations house a separate team that is solely responsible for performance testing. [2] Virtual users are simulated users that testing applications use to simulate the impact of multiple users on a system without requiring “real” users to sit around testing the application. A user session is recorded for each virtual user and can be played back as if a real user were using the application. Although performance, load, and stress testing are related, they are not the same thing and are not carried out in exactly the same manner. Performance testing involves executing the functional behavior of the application and essentially timing how long it takes for each result to complete. The amount of time that a single task takes to finish is known as its response time. If you execute the method many times and then take the average, this is its average response time. The average response time for the signin action in the Storefront application, for example, is roughly 250 milliseconds.[3] This result is for a single user. You should always conduct the initial performance testing using a single user to get a baseline. If there are performance bottlenecks for a single user of the system, you can bet that these problems will have an impact when multiple users start logging in. In general, the faster the response time is, the faster the application is. This end-to-end time can also be thought of as the transaction time for the function being tested. [3] The tests were conducted on a Pentium III 750 MHz machine with 1 GB of memory and all tiers collocated on the same box. Based on the response time, you can come up with a rough throughput time. Throughput defines the number of transactions that can occur in a set amount of time. The theoretical throughput that is calculated based on a single user will probably differ with real loads. Due to multiprocessing and other hardware and software features, applications can achieve a higher throughput by adding more hardware and software resources. This enables the application to process more transactions per time period, which increases the throughput numbers. Load testing is analogous to volume testing. This type of testing is performed to see how the application will react to a higher user load on the system. During this type of testing, you can adjust the hardware and software configurations to determine which configuration gives the best throughput for a given user load. Load testing is usually hard to conduct because you are constantly going back and forth, adjusting configuration systems to see what gives you a higher throughput. No application can sustain an infinite user load. The idea is to try to maximize the number of concurrent users with an acceptable average response time. Throughput is usually measured in transactions per second (tps), but it can also be measured per minute, per hour, and so on. Armed with response times and throughput numbers, you can make intelligent decisions about how the application should be configured to ensure the best performance and scalability for the users. You should share these numbers with the network engineers, so they’ll understand how much network bandwidth the application might require.
You want to have a cheap webhost for your apache application, then check apache web hosting services.
Posted in Domain | No Comments »
December 20th, 2007
According to Alberto Savoia, the Director of Software Research at Sun Microsystems’s Laboratories, there are four behavioral laws that make web page performance critical to an organization’s success: The Law of Stickiness This law states that web users are sticky, but not loyal. If they find a web site that serves their needs, they tend to continue to use that site. If the web site begins to respond slowly and cause the users to wait, they will move to another site that fulfills their same needs. The point is to strive to keep the performance of the application strong in order to keep the users coming back. The Law of User Perspective This law states that you should always measure the performance of your application from the user’s point of view, not from your own. The point here is that, for example, while your environment may have a 100-MB network with an otherwise light load on it, the user may be using a modem with a much smaller bandwidth capability. Always keep in mind what the user’s environment and network capabilities will be and test accordingly. The Law of Responsibility This law states that the users don’t care what or who is at fault for poor web site performance; they will always blame the application. The problem might be their ISP or another nonapplication issue, but most users will not be able to isolate the problem to that level and instead will blame the application or site. You must be aware of all the factors that may impact the performance of your application. The Law of Expectations This law states that users’ satisfaction is based on their expectations, which are set by their personal experiences with other, similar web sites. When measuring the performance of your application, don’t rely just on arbitrary numbers to indicate what’s slow or fast; compare your results with those of your competitors. These simple, common-sense laws explain the human-behavior aspects of web site performance. In general, however, slow is slow and fast is fast, and generalizations can be made across applications and business domains. But before we discuss how to detect whether performance problems exist in an application, a distinction must be made between the types of performance testing that should be conducted. 17.2 Performance Versus Load Testing There are many different types of software testing: functional, unit, integration, white box, black box, regression, and so on. Performance and load testing are among the most important types of testing, but they usually get the least amount of attention. There are two general reasons for this neglect. The first reason is that developers typically wait until the very end of the development cycle to start testing the performance of the application, and the end of the cycle is when you have the least amount of time for testing. It is true, however, that it’s not always practical to conduct performance testing during every phase of development. Early phases tend to focus on the architecturally significant pieces, and there may not be enough of the application built to test its performance. You should, however, gather some preliminary performance measurements as early as possible.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.
Posted in Domain | No Comments »
December 19th, 2007
standards if the application is sluggish. Even the most useful and desired application will quickly be rejected by the user community if it’s slow to respond to users’ requests. For web-based applications, organizations must test and measure how fast the various web components are, how many simultaneous hits the web site can handle, and how scalable the software and hardware resources are. They must also understand how the performance of the application will be affected during peak loads. This chapter explores the performance implications of using the Struts framework and its associated technologies to build web applications, and how certain design and programming decisions will affect the overall performance of the application. A distinction is made between performance, load, and stress testing and the steps necessary to carry out each. 17.1 What Is Good Performance? Most developers have had the unfortunate experience of building a slow application. Obviously, developers don’t set out to create slow applications, and there probably isn’t a user group asking, “Could you please make the application run very slowly for us?” Too often, bad performance isn’t discovered until the application is finished and installed into a production environment. But why does this happen? The simple truth is that it happens because not enough attention is given to performance matters during design and construction. This is not to say that performance should be the primary focus at all times if you focus on performance too exclusively or too soon, it may negatively affect the design and code. On the other hand, if you wait too long, you may find yourself with upset users complaining about poor performance, and you’ll be left wondering what went wrong. You may have heard the axiom “Test soon, test often.” This is a good principle to follow to help ensure that you are not surprised at the end of construction with a poorly performing application. The sooner you can detect a performance problem, the more likely it is that you’ll get a chance to fix it before the application goes into production. Another apt saying is “Don’t leave any broken windows.” This means that when you detect a problem, you should fix it and not let it linger. Picture a building with a broken window that’s not immediately fixed. If people are led to believe that having one broken window in the building is acceptable, they will eventually decide that it’s all right to have many broken windows. Before long, the building will be in shambles, and all the tenants will have moved out. If you find obvious performance problems during early tests, fix them. So how do you measure the performance of a web application? What’s considered acceptable or too slow? The answers to these questions are strictly related to the nonfunctional requirements of the application.[1] There are tangible and quantitative measurements that can be taken to help determine whether the application is able to meet the minimum requirements set out in the nonfunctional requirements. [1] The nonfunctional requirements are part of the analysis work that should be done for any nontrivial application. These requirements describe the broader issues of the application, such as availability, disaster recovery, package dependencies, hardware configuration, and, almost always, performance criteria. The problem is that each application is different and therefore has different nonfunctional requirements. One application might need to have an average response time of 3.0 seconds and support 50 concurrent users, while another might have to support 500 simultaneous users. Performance testing is a little more nebulous than functional testing, where it’s easy to see when the application fails to meet the design specifications.
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.
Posted in Domain | No Comments »
December 19th, 2007
16.5.2 Using Microsoft Task Scheduler The Windows platform contains an application called Task Scheduler (or Scheduled Tasks in newer versions of the platform). This program performs the same function as cron, but for the Windows platform. It has a wizard that walks you through setting up a task that gets fired off at regular intervals. Figure 16-4 shows the main screen of the Scheduled Tasks application. A task has been created that will invoke a batch file that can in turn call Ant to perform a build for your environment. Figure 16-4. The Scheduled Tasks application on the Windows platform The amount of control that you have over the time intervals is not as granular as it is on the Unix platform. However, it is sufficient enough to kick off daily builds at a certain time. See the Windows documentation for your specific version for more details. Part of automating your build environment is pulling the source files from the source code repository and compiling them. Most source control systems, such as Clear Case, CVS, and PVCS, have a command-line API to pull source files in a read-only mode in order to compile them. Using Java and Ant, this part of the automation process is pretty straightforward. 16.6 Restarting Your Server Remotely If your deployment server is located on a different server from the build environment (and it really should be), you will need to move the deployment files over and possibly restart the server. The easiest way to do this is with the Ant ftpand telnet tasks. You can even have Ant email you reports on the result of the latest build using the email task. See the Ant documentation for more information on these and other helpful tasks. Chapter 17. Addressing Performance Achieving good performance with an application is absolutely critical to its acceptance by the user community. Not many users are willing to appreciate a great design and excellent programming
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.
Posted in Domain | No Comments »
December 18th, 2007
The distclean target reverts the project back to its pristine “distribution” state. That is, all build products class files and the WAR file are removed, so the project directory looks the same as it did when the project directory tree was first installed. Note that the distclean target calls the cleantarget. While this isn’t really necessary for this small project, it demonstrates more of the power of Ant by invoking another target via the antcall task. The antcall task can even call a target with arguments, but that is beyond the scope of this book. There are various plug-ins that you can download that allow you to use Ant inside of your specific IDE. For example, the AntRunner plug-in allows Ant to be used within the JBuilder IDE. For this and other plug-ins, see the external tools section of the Ant site at http://jakarta.apache.org/ant/external.html. 16.5 Creating an Automated Build Environment Once you have put together a satisfactory build environment, you should go the extra step to automate it. This means that no human interaction is needed to execute new builds. It’s very common for build frequencies to increase the closer you get to the end of a construction phase. You can, of course, just manually kick off builds when you need them, but a better and much more efficient approach is to use a scheduling mechanism to invoke your Ant build environment. There are at least two scheduling mechanisms that you can employ, depending on your environment. In Unix, you can use the cron daemon, and on the Windows platform, you can take advantage of the Task Scheduler. 16.5.1 Using cron to Invoke Ant cron is a program that allows you to automate tasks by running user-defined programs at regular intervals. cron allows you to define both the program that is to be run and the exact time at which to run it. The cron program is a daemon program, which means that it runs in the background until it’s needed. It wakes up every minute, checks to see if there are any scheduled tasks that need to be performed, and, after it runs the tasks, goes back to waiting. The list of tasks for cron to execute comes from a file called a cron table, which is commonly referred to as crontabs. The crontabs is a schedule that lists the tasks to run and the date and time to run them. Some system administrators may disable cron from running on a server in order to save processing power. In this case, you’ll need to get permission to run cronprograms. You can verify that cron is running and that you have permission to access it by typing crontab-l at the command prompt. All you need to do is edit crontabs and add an entry that calls your ant program, which in turn will kick off the build. Check the Unix manpages for more information on using cron.
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.
Posted in Domain | No Comments »
December 17th, 2007
As mentioned previously, the war target is the default target for the project. This means that when Ant is run from the command line without a target argument, the war target is executed. The war target runs only if the compiletarget has been run first. The war task requires you to define the name of the WAR file and the location of the web.xml file. All the other attributes are optional; if you are interested in seeing them, they are listed in the online Ant documentation (http://jakarta.apache.org/ant/manual/CoreTasks/war.html). Another great reference on Ant is Ant:TheDefinitiveGuide by Jesse Tilly and Eric Burke (O’Reilly). The nested elements tell the war task where the contents of the WAR file are located. The fileset element defines the base web content of the WAR file. This element is used to declare where the HTML files, JSP pages, images, and so on are located. The classes element points to the Java class files that should be included in the WEB-INF/classes directory in the WAR file, and the lib element declares which files should be included in the WEB-INF/lib folder. In the Storefront example, everything in the web subdirectory is included. The various subdirectories contain all of the necessary resources (HTML, JSP pages, images, etc.). All of the compiled classes in the build subdirectory are copied into the WAR file’s WEB-INF/classes directory along with the properties files. All of the third-party JARs in the lib subdirectory are copied into the WAR’s WEBINF/lib directory. If the lib subdirectory contains any JARs that you don’t want to be included, you can use the following snippet:
Here, all the JARs in the lib directory except dont_need.jar will be copied into the WAR file’s WEBINF/lib directory. The last and often the clearest option is to explicitly include each desired JAR file. While slightly more verbose, this method is immune to changes to the lib folder if other developers in the project start adding JARs indiscriminately. It is also much easier to see exactly what is going to be included in the WAR file. 16.4.6 Cleaning Up The final two targets are trivial but important. The clean target deletes the build directory, thus removing all of the Java class files:
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.
Posted in Domain | No Comments »
December 16th, 2007
Specifying the depends attribute allows you to control the order in which Ant targets are executed. In this case, the compile target is not executed until the prepare target has been executed: The prepare target generates timestamp values that can be turned into properties and attached to compilation products such as JAR and WAR files. For this small project, however, timestamps are not used. The prepare target also creates the necessary output subdirectories for our Java classes and WAR file. The compile target instructs Ant to run the javac compiler on all the files within the source directory and send all the class files to the build directory. The deprecation option is on, so you’ll get a detailed message if you accidentally include a deprecated method in one of the source files: The javactask uses the build.classpath property shown in the previous section. 16.4.5 Using Ant to Build the WAR File The Ant wartask builds the web archive. The wartarget used to build the web archive is shown here: building war…
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.
Posted in Domain | No Comments »
December 15th, 2007
commented out; you just need to uncomment the one that you want to use. Tomcat’s deployment directory is the webapps directory found just under the Tomcat root directory. Tomcat keeps the servlet API classes in the common/lib/servlet.jar relative to the Tomcat root directory. Lastly, we need to define the classpath that will be used during compilation of our project. Ant allows us to associate a set of files with a property name. In the following build.xml fragment, the list of all the JAR files necessary to compile the Storefront example is bound to the build.classpath property:
We could have used include elements to define the build.classpath property in far fewer lines; however, it’s much clearer to explicitly list each JAR file used during the build process so that nothing that might prevent a successful build is added or omitted. Dereferencing the property name using the Ant syntax ${property} allows the tasks to use the build.classpath property. 16.4.4 Compiling Java Source Files The Java source files for the Storefront application are compiled using the Ant javactask. The compiling target, compile, depends on the prepare target: A target may depend on zero or more other targets, using the following syntax:
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.
Posted in Domain | No Comments »
December 14th, 2007
A target takes the form: … A target must have a name and may have several additional attributes that determine when and if the target actually gets executed. The target should contain zero or more tasks. A task is an atomic unit of work in the Ant world. Each task is bound to a Java class file that Ant executes, passing to it any arguments or subelements defined with that task. The Ant tool is extensible and allows you to create your own tasks. For this book and the Storefront example, the built-in tasks included with the Ant distribution are all you will need. If, however, you needed to create a new task, you could do so by defining the task in the build.xml file, using the taskdef task to bind the task name to a Java class file. The Java class file must extend org.apache.tools.ant.Taskand be located in the Ant classpath. There are several other requirements that are beyond the scope of this book, but details can be found in the Ant documentation. Before you run Ant, you may have to change a few properties in the Storefront build.xml file to suit your development environment:
These three properties define where the servlet container is located, where its deployment directory is located, and where it keeps the servlet API classes. First, the webserver.home property is set to the root directory of the servlet container. In this case, the Tomcat 4.0 web server and servlet container are being used. The Storefront build.xml file supports several other containers, but they are
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.
Posted in Domain | No Comments »
December 13th, 2007
A Brief History of Ant Ant is a Jakarta project created in early 1998 by James Duncan Davidson, who also wrote the original Tomcat servlet container. Initially, Ant was written as a utility to build Tomcat. Others quickly saw the benefits of Ant over make, and it was moved to its own CVS project and officially became a separate Jakarta project in 2000. 16.4.2 Installing and Configuring Ant You can download Ant from the Jakarta web site at http://jakarta.apache.org/ant/. The examples provided in this chapter were tested with Ant 1.4, but they should be compatible with at least Ant 1.3. Download the binary zip file (for Windows) or the .tar.gz file (for Unix) and uncompress the archive into your desired installation directory. You should also download the 1.4.1 optional.jar file and install it in the ANT_HOME/lib directory. While it’s not used in this project, the optional.jar file has many extra tasks that you may find useful in the future. Ensure that the ANT_HOME/bin directory is added to your system PATH. Your installation may also require you to add the ANT_HOME environment variable, which should be set to the Ant installation directory. The Ant binary typically can determine what ANT_HOME should be, but if you get an error when trying to run Ant, set this environment variable. There is also a caveat when running Ant under Windows 95/98 do not install it in a directory with a long pathname, because the batch file used to run the installation script may not be able to handle the pathname. See the Ant installation documentation for more information. 16.4.3 Getting Started Ant reads its build commands from an XML file. By default, it looks for a file called build.xml, but you can give the file any name by using the -buildfile option when running Ant. From a command prompt, change directories to the base project directory, which in our example is called storefront. In here, you should see the build.xml file. The Ant build file consists of a project that has zero or more targets, each of which consists of zero or more tasks. The project element is defined at the top of the build file:
The project is named storefront and the default target to execute is the wartarget. The default target is what gets executed if you type ant at the command line without specifying a target. Because the project root directory is the same directory that the build.xml file is located in, “.” is used to indicate the base directory property. The build directory structure for the Storefront application is shown in Figure 16-3. Figure 16-3. The build structure for the Storefront application
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.
Posted in Domain | No Comments »