# The Server

### Start With the Browser

The browser is one of the best tools for seeing how the overall application is working but when we look at JavaScript running on the server, it seems that the browser shouldn't be of much help.

Browsers do give us some information. In particular, we discussed TTFB or Time To First Byte earlier. TTFB is mostly a measure of server performance, and if it is more then about half a second, something should be done to speed up the server.

All the browser lets us see about the server's performance is what endpoints are slow. Knowing which API endpoints or pages are slow gives us a place to start looking for what is causing the slowdown.

### General Server Statistics

Another place we should start looking for performance bottlenecks is by looking at general server statistics. CPU usage, memory usage, and bandwidth usage are all areas to track.

In particular when checking CPU usage and memory usage you should review individual applications, such as NodeJS or any other application that may be consuming a significant portion of your processing power or memory usage.

### Check Databases and Other External Sources

If the server uses a database or accesses another server, you will want to check how those are performing as well.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.jedjs.com/fix-it-or-leave-it/profiling-the-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
