The server monitors and analyzes the data such as the number of API calls and response time. The server is similar to the server interface provided to the mobile app. The possible solution is as follows: 1. the most direct method is to add the statistical code to each method. 2. use aop to monitor and analyze the data such as the number of each API call and response time without interfering.
The server is similar to the server interface provided to the mobile app.
You can think of the following solutions:
1. the most direct method is to add statistical code to each method.
2. use aop to make statistics without interfering with the original code.
3. logs can be recorded in the program and then analyzed in the log method.
I hope experienced users can talk about the advantages and disadvantages and recommend the appropriate ones.
Reply content:
The server monitors and analyzes the data such as the number of API calls and response time.
The server is similar to the server interface provided to the mobile app.
You can think of the following solutions:
1. the most direct method is to add statistical code to each method.
2. use aop to make statistics without interfering with the original code.
3. logs can be recorded in the program and then analyzed in the log method.
I hope experienced users can talk about the advantages and disadvantages and recommend the appropriate ones.
1 or 2
3 and 1 2 do not conflict
You do not need to use aop to collect statistics on interface calls like this. you can add a statistical code at a unified entrance location. this portal can get the name of the currently called interface and then time it, wait for the interface to return and stop timing to get the time-consuming data and whether the logs are successful and failed, and then report (you can report [do not block Services, recommended], TCP reports [may be blocked, not recommended], write logs [there are a large number of disk IO, not recommended])
Send you a written statistics server, including the reporting interface, udp reporting, and web page display.
Https://github.com/walkor/workerman-statistics
This is a json-rpc of php, which is integrated with this statistical system.
Https://github.com/walkor/workerman-JsonRpc
System level: cacti zappix can be monitored for a long time. of course, alarm can be triggered based on the SMS threshold value of the email.
Business Application layer: use goaccess to visually analyze nginx logs.
If the front-end is nginx, you can use a tool to analyze access. log for statistics, write a script to collect statistics at intervals, and then write the statistics to the database.
Write a statistical interceptor and synchronize it to the data platform for analysis through kafaka or writing logs through flume
The log is written asynchronously when the API interface processes the request, and then analyzed using another parsing system. The interface is displayed or the API interface is provided for the original program call.
Tomcat's built-in access log can print the time when a url is called, and then statistics based on this access log can be done.