Objectives
In this article, you will learn how to perform the following tasks:
- Examine the Cloud logs
- View Profiler information
- Explore Cloud Trace
- Monitor resources using dashboards
- Create uptime checks and alerts
Examine the Cloud logs
- Return to the Console and click the App Engine > Versions link on the left.
- Click Tools in the Diagnose column of the table, and then click Logs.
- The logs should indicate that Profiler has started and profiles are being generated. If you get to this point too quickly, wait a minute and click Refresh.
View Profiler information
In the Cloud Console, on the Navigation menu (Navigation menu icon), click Profiler. The screen should look similar to this:
Note: The gray bar at the top represents the total amount of CPU time used by the program. The bars below represent the amount of CPU time used by the program's functions relative to the total. At this point, there is no traffic, so the chart is not very interesting. Throw some load at the application.
On the Navigation menu, click Compute Engine.
Click Create Instance to create a virtual machine.
Change the region to someplace other than us-central1 (the App Engine app is in us-central1). Accept all the rest of the defaults and click Create.
When the VM is ready, click SSH to log in to it.
You will generate some traffic to your App Engine app using the web testing tool called Apache Bench. Enter the following commands to install it:
sudo apt update
sudo apt install apache2-utils -y
Update <your-project-id> with your PROJECT_ID from connection details panel and enter the following command to generate some traffic to your App Engine application:
ab -n 1000 -c 10 https://<your-project-id>.appspot.com/
The command will make a thousand requests, 10 at a time, to your application.
Note: You have to change the URL to point to your application. Recall that you can find the URL in the App Engine Dashboard. It is also on the browser tab you used to test your app, if you haven't closed it. Also, make sure you insert a slash (/) at the end of the URL.
When the requests are finished, on the Navigation menu, click Profiler.
Now there is a more interesting chart. Each bar represents a function. The width of the bars represents how much CPU time each function consumed.
The Profiler is a way developers can track down parts of a program that are consuming too many resources.
0 Comments