Monitors core activity to maximize multiprocessing.
Modern CPUs are usually multi-core processors. However, unless special considerations are made, processes are usually single-threaded. The goal of this app is to allow remote monitoring of CPU activity across multiple cores and see the difference in CPU core activity.
- Programming Language: Go
- HTMX is used to enable direct access to dynamic behavior using HTML and CSS without additional Javascript
- Websocket is used as the application is expected to remain alive and update in a periodic pattern. WebSocket reduces the data transmission overhead compared to HTTP-based alternatives.
- gopsutil is used to obtaining system information due to the ease of access of system information.
- Bootstrap for theming and styles as there are predefined templates for grid and content presentation suitable for this project.
- Chart.js is used to display charts as its free and the results are easy to read.
This application uses the Model-View-Controller pattern, where:
- Model: System data, accessed via
gopsutil - View: HTMX content displayed when user establishes a WebSocket connection
- Controller: Go server, which accepts WebSocket connection request and streams data to the client.
This pattern is chosen because of the ease of working on each part separately and makes debugging issues (on presentation vs data) easier.
- Clone the repository
- Change directory into
cpu-balancerepository folder - Run
go mod tidyto update and cleanupgo.modandgo.sumfiles - Run
go run ./cmd/main.goto start the program - Access the CPU balance dashboard at
[http://localhost:8080/](http://localhost:8080/)
- sigrdrifa's go-htmx-websockets-example for inspiration
