[GH-ISSUE #436] Use Virtual Threads #155

Closed
opened 2026-02-26 04:34:13 +03:00 by kerem · 1 comment
Owner

Originally created by @mageddo on GitHub (Apr 24, 2024).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/436

What is expected

  • Optimize resource utilization by using Java Virtual Threads

What is Happening

What is the actual behavior and lacks without this feature and what's the fallback while this feature is not implemented yet

Changes (Optional)

  • Migrate thread pools to virtual thread ExecutorService
  • Create stress-test module which will point to an running instance of DPS
  • Create way to collect metrics of a running instance of DPS to compare the resources utilized across different versions

Refs

Export a process stats to Prometheus

How to export docker metrics (the docker engine itself not specific container metrics)

Data

docker-compose -f src/stress-test/docker/docker-compose.yaml up  --build
rate(container_cpu_user_seconds_total[30s]) * 100
dig google.com @127.0.0.1 -p5753
https://stackoverflow.com/a/34930574/2979435

Depends on #435

Originally created by @mageddo on GitHub (Apr 24, 2024). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/436 ### What is expected * Optimize resource utilization by using Java Virtual Threads ### What is Happening What is the actual behavior and lacks without this feature and what's the fallback while this feature is not implemented yet ### Changes (Optional) * [x] Migrate thread pools to virtual thread ExecutorService * [x] Create stress-test module which will point to an running instance of DPS * [x] Create way to collect metrics of a running instance of DPS to compare the resources utilized across different versions ### Refs #### Export a process stats to Prometheus * [process-exporter][4] * [instrumenting exporters][5] #### How to export docker metrics (the docker engine itself not specific container metrics) * [monitor-infrastructure/integrations/integration-reference/integration-docker][1] * [Collect Docker metrics with Prometheus][2] * [How to monitor Docker metrics using Prometheus & Grafana?][3] ## Data ``` docker-compose -f src/stress-test/docker/docker-compose.yaml up --build rate(container_cpu_user_seconds_total[30s]) * 100 dig google.com @127.0.0.1 -p5753 https://stackoverflow.com/a/34930574/2979435 ``` Depends on #435 [1]: https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-docker/# [2]: https://docs.docker.com/config/daemon/prometheus/ [3]: https://medium.com/geekculture/how-to-monitor-docker-metrics-using-prometheus-grafana-707b970f1f06 [4]: https://github.com/ncabatoff/process-exporter [5]: https://prometheus.io/docs/instrumenting/exporters/
kerem 2026-02-26 04:34:13 +03:00
Author
Owner

@mageddo commented on GitHub (Jul 30, 2024):

3.24.0 (No Virtual Threads)

 this.doNRequestsFor(executor, 1_000, Duration.ofSeconds(20));

image

Using Virtual Threads

 this.doNRequestsFor(executor, 1_000, Duration.ofSeconds(20));

image

<!-- gh-comment-id:2259020147 --> @mageddo commented on GitHub (Jul 30, 2024): ### 3.24.0 (No Virtual Threads) ``` this.doNRequestsFor(executor, 1_000, Duration.ofSeconds(20)); ``` ![image](https://github.com/user-attachments/assets/ffd3f73e-10a4-4180-8b39-25c3e87b158e) ### Using Virtual Threads ``` this.doNRequestsFor(executor, 1_000, Duration.ofSeconds(20)); ``` ![image](https://github.com/user-attachments/assets/a1e0576f-5065-4322-99ca-bc206c9eb2f4)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#155
No description provided.