Лучшая конфигурация для RESIENIENT4J RateLimiter, Bulkhead и Tomcat Threads для обработки более чем 150 000 запросов в сJAVA

Программисты JAVA общаются здесь
Anonymous
Лучшая конфигурация для RESIENIENT4J RateLimiter, Bulkhead и Tomcat Threads для обработки более чем 150 000 запросов в с

Сообщение Anonymous »

Я создаю монолитное приложение для пружинной загрузки, которое, как ожидается, будет обрабатывать не менее 150 000 запросов в секунду на сервере с 8 ядрами ЦП и 16 ГБ ОЗУ. Конфигурация: < /p>

Код: Выделить всё

resilience4j:
circuitbreaker:
instances:
studentService:
slidingWindowSize: 10
failureRateThreshold: 50
waitDurationInOpenState: 5000
permittedNumberOfCallsInHalfOpenState: 3
automaticTransitionFromOpenToHalfOpenEnabled: true

ratelimiter:
instances:
studentRateLimiter:
limitForPeriod: 10000
limitRefreshPeriod: 1s
timeoutDuration: 500ms

bulkhead:
threadpool:
instances:
studentService:
maxThreadPoolSize: 100
coreThreadPoolSize: 20
queueCapacity: 1000

server:
tomcat:
accept-count: 20000
max-threads: 400
min-spare-threads: 20
< /code>
Мои основные вопросы: < /p>
[list]
[*] Учитывая цель обработки не менее 150 000 запросов в секунду, каковы рекомендуемые значения для: < /li>
< /ol>
[list]
rateLimiter.limitForPeriod
[*]

Код: Выделить всё

bulkhead.threadpool.maxThreadPoolSize
[*]bulkhead.threadpool.queueCapacity
[*]tomcat.max-threads
[*]tomcat.accept-count
2.How do these settings interact? For example, if RateLimiter allows 10,000 requests per second but Bulkhead only has 100 threads, will requests get rejected or queued? How to balance these limits to avoid losing requests?
[/list]

[*]How does the Tomcat thread pool relate to the Bulkhead thread pool? Should Tomcat threads be set higher or lower than Bulkhead threads?
[*]Will having a large number of Tomcat threads (e.g., 400 or more) cause high CPU or memory usage? How to tune this optimally for an 8-core server?
[*]What is the best way to queue or buffer requests if Bulkhead threads are busy, without dropping calls?
[*]Is using both RateLimiter and Bulkhead together beneficial, or will RateLimiter just add overhead?
[*]How can I effectively monitor and track the real-time usage of RateLimiter, Bulkhead, and Tomcat threads to tune the system accordingly?
[/list]

Код: Выделить всё

@GetMapping("/{id}")
@CircuitBreaker(name = "studentService", fallbackMethod = "getStudentFallback")
@RateLimiter(name = "studentRateLimiter")
public ResponseEntity getStudent(@PathVariable Integer id) {
return studentService.getStudentById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
Я хочу убедиться, что мое приложение может обрабатывать высокую нагрузку с минимальным отказом или задержкой.>

Подробнее здесь: https://stackoverflow.com/questions/796 ... threads-to

Вернуться в «JAVA»