2

I have a back-end service in Java that I need to test its performance. It is not exposed to web and may never be. I was wondering how I can test this multi-threaded service's (simply a class with public methods) performance under a lot of traffic (100K+ calls per second).

2 Answers 2

4

If you are saying to create 100K+ calls per second by your program ,then use ThreadExecutor to create maximum threads you want to test for public methods in yours call. For example following code simaultaneously call yours public methods with 1000 threads accessing the methods

ExecutorService executor = Executors.newFixedThreadPool(1000);
         List<YourClass> callingList = new ArrayList<YourClass>();
         for (int i = 0; i < 1000; i++) {
             EntryPoint Impl = new EntryPoint (YourClass);
             callingList.add(Impl);
         }

 private Class EntryPoint implements Callable<Object>{
          private YourClass example;
     EntryPoint (YourClass  class) {
                this.example =  class;

            }
public List onCall() throws InterruptedException {
example.yourPublicMethod(); 

If you want to measure time taken by each threads for each methods use aspectJ for interceptor.You can record the time taken for each methods in a list through out the call of 1000 threads.Finally u can aagain iterate a list to get time taken for each on each methods .If you are looking for tools u can use VisualVM Or Jconsole.You can get information about CPU usuage,memory usuage ,threads status ,garbage collector,number of objects created and byte consumbed by objects and number of class loaded and many more .

Sign up to request clarification or add additional context in comments.

Comments

1

JMeter works well for load testing.

http://jmeter.apache.org/

1 Comment

Can I use JMeter for an internal service?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.