简体   繁体   中英

Measure performance of Web-services in Android Application

I want to measure time response (performance) of web services . I have an Android application to consume those services , and I want to register the time between a request and a response . Is there any form to do something like create and write in a text file those times?

How can I do that?

I'd suspect your making HTTP calls in your Android app. As this factors in also network delays depending on where the server is located, all the intermediate devices (routers, network infrastructure, etc) and technology (3G vs wifi) it is not a very good indication of performance of your web-service.

Monitoring should be done server side in order to see variables such as the load, number of requests, memory usage, cpu utilization, etc. in addition to request logs.

Specifically, what you can measure from your Application is: - Delay between the sending of the HTTP request, and the receiving of the response on your device.

If your only interested in calculating delay you can take the timestamp of when you make the request, and subtract it later on with the time stamp of when you receive a response. You can use System.System.currentTimeMillis() to get UNIX time in MS. See: Time measuring overhead in Java

In order to actually measure performance of a webservice I would suggest:

  1. Running a monitoring application such as JMelody (Tomcat) on your webserver
  2. Simulating many requests using a tool such as JMeter
  3. Profiling your algorithms
  4. Checking many variables related to processing time, memory usage, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM