日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Spring Boot: Tuning your Undertow application for throughput--转

發布時間:2025/4/5 javascript 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spring Boot: Tuning your Undertow application for throughput--转 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

原文地址:https://jmnarloch.wordpress.com/2016/04/26/spring-boot-tuning-your-undertow-application-for-throughput/

It’s been some time since the previous blog post, but finally I though that it’s a good?time to make a post about very useful and practical aspect. How to prepare your Spring Boot application for production and how to guarantee that it will be able to handle a couple of millions of views each day.

If you think that?you have already made all the needed steps by making your application stateless, scaling it out or?running it on the high end machine, think twice because it’s quite likely that there are some bottlenecks inside your application that if not treated with proper attention would most likely degradate?the performance and the application overall throughput.

Tuning for latency vs tunning for throughput.

Interesting enough in the past, being aware of the Little’s Law I have thought that tuning your application throughput requires nothing more then reducing your application latency as much as possible. It was just after reading the book?Java Performance?the after I realized that might not be true in all of the cases.

Generally you can improve the latency first by improving your application algorithmic performance, after that you should take a look on access patterns in your application introducing a caching layer?or?redesign the way your application is accessing the data?can have huge impact on the overall performance.?If your application is heavely I/O bound performing operations in the parallel can be a way to improve things a bit.

Also a good idea for improving you application latency is to configure?asynchronous logging whether you using Logback or Log4J2, but of them provide proper functionality.

Thread pools

Undertow

Undertow uses XNIO as the default connector. XNIO has some interesting?characteristics apart from the default configuration which by default is I/O threads initialized to the number of your logical threads and the worker thread equal to 8 * CPU cores. So on typical 4 cores Intel CPU with hypert-hreading? you will end up with 8 I/O threads and 64 working threads. Is this enough? Well, it depends. Considerably the Tomcat’s and Jetty defaults are 100 and 1000 threads respectively. If you need to be able to handle more request per second this is the first thing that need to consider to increase.

Hystrix

The Hystrix documentation states that:

Most of the time the default value of 10 threads will be fine (often it could be made smaller).

After working with couple of the projects, I found it hardly to believe that this could be a true statement. The defaults for Hystrix is 10 threads per pool, which quickly might turn out to become a bottleneck. In fact the same documentation also states that in other to establish the correct size?of hysterix?thread pool you should use the fallowing formula:

requests per second at peak when healthy × 99th percentile latency in seconds + some breathing room

So let’s assume that you have a system that has to handle let’s say 24 000 rps, divided by the number of instances, for instance 8, you can establish the appropriate pool size for single instance. This will vary greatly on the latency of your system.

RxJava

Memory usage

All of this is not given without a price. Each of the newly allocated threads consumes memory.?Through Java you can configure this property through?-Xss?property with the default for 64 bit VM being 1 MB. So if you let’s say configure your Undertow thread pool with 512 working threads, be ready that your memory consumption (only for allocating the thread stacks) will be increased to that number.

Connection pools

HTTP

Do you use for instance RestTemplate, or maybe RestEasy JAX-RS client. In fact there is a well known issue reported in RestEasy that uses exactly ONE connection for all of your calls.?The good advice is to align that value with the number of working threads of your application server, otherwise when performing the HTTP calls the threads will be waiting for acquiring the underlying HTTP connection from the pool, which will cause unnecessary and probably unintended delay.

Cache

The same basic principal applies to any other kind of service that is being communicated over TCP connection. For instance Memcached clients like XMemcache has nice capabilities of using a multiplexed TCP connection with binary protocol on top of it, giving a throughput of roughly 50 requests per connection, though still if you need to be able to handle greater throughput you need to configure your client to maintain a entire pool of?connections.

Garbage collection

If you opt for low latency, probably you should consider optimizing the Garbage Collector as the last kind of resort. As much as garbage collection could be optimized through different settings this does not handles the true problem, ?if you can address those?issue first you should be able to be just find and tune the garbage collector afterwards for the best overall performance.

Final thoughts

Equipped with this practical knowledge how you will be able to tell if your application is your application faces any of those problems, first of all equipped with proper tools. Stress test are one of them, you can either decide to treat the application as a black box and use for instance Gatling to measure the throughput of your application, if you need need more fined grained tools the jmh project that could used for running benchmarks of the individual Java methods. Finally use profiler to understand where your application is spending the most time, is it for instance a RestTemplate call, or maybe your cache access time sky rockets whenever you? A good advice on how to measure the characteristics of the application is to use the doubling approach, run your benchmark with for instance 64?RPS –?monitor the results, and repeat the experiment with?double?the request number. Continue as long as you haven’t reached the desired throughput level.

With all of this being said, the true is that this in fact describes the hard way, there is also a simple and fast path to solve your heavy load problems especially for HTTP:

Use a caching reverse proxy.

Either if it’s Nginx or Varnish, both of them?should take the load out of your backing services and if you can decrease?your load ?you do not need spend so much time on the optimizations.

轉載于:https://www.cnblogs.com/davidwang456/p/6742543.html

總結

以上是生活随笔為你收集整理的Spring Boot: Tuning your Undertow application for throughput--转的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 色就是欧美 | 日韩黄色一区二区 | 四季av一区二区三区免费观看 | 青青草午夜 | 亚洲免费色 | 国产无码精品在线播放 | 美女xx00| 国产亚洲精品码 | 日日狠狠久久 | 国产精品久久久久久久无码 | 欧美日本道 | 日韩免费av| 欧美日本一区二区 | 狠狠干婷婷 | 男人天堂手机在线观看 | 亚洲免费观看高清完整版在线 | 一区二区少妇 | 日韩福利视频在线观看 | 伦理片波多野结衣 | 女人的黄色片 | 国产精品久久一 | 国产大片一区二区三区 | 人人射人人爱 | 国产无套内射又大又猛又粗又爽 | 牛牛视频在线观看 | 福利一二区| 亚洲欧美日韩专区 | 国产精品久久久久久久成人午夜 | 日韩美女激情 | 亚洲最大福利视频 | 午夜影院在线 | 九一国产在线 | 亚洲美女屁股眼交3 | 午夜精品久久久久久99热 | 啦啦啦免费高清视频在线观看 | 亚洲婷婷在线观看 | 综合一区在线 | 大地资源二中文在线影视免费观看 | 啪啪免费网 | 欧美 日韩 国产 在线 | 久久网av| 精品视频免费在线 | 精品福利在线观看 | 欧美视频一二三区 | 国产黄色大全 | 成人亚洲电影 | 久久精品影视 | 一直草| 打屁股无遮挡网站 | 人妻精品无码一区二区 | 国产精品一区二区亚洲 | 国产高潮国产高潮久久久91 | 亚洲黄色大片 | 粉嫩一区二区三区 | 三日本三级少妇三级99 | 亚洲一区影院 | 亚洲制服丝袜诱惑 | 亚洲男女视频 | 人人妻人人澡人人爽久久av | 中文字幕第10页 | 欧美乱论视频 | 毛片中文字幕 | 91色区| 麻豆精品国产传媒mv男同 | 国产自产一区二区 | 国产噜噜噜噜久久久久久久久 | 韩国三级av | 超碰一区二区三区 | 亚洲欧美中文日韩在线观看 | 日本一区二区三区在线观看 | 午夜精产品一区二区在线观看的 | 免费中文字幕视频 | 国产图片区 | 亚洲一区二区三区四区五区xx | 国产在线激情视频 | 国产a v一区二区三区 | 天天舔天天干天天操 | 亚洲天堂2020 | 日本不卡在线视频 | 奇米亚洲 | 日韩岛国片 | 亚洲精品国产欧美在线观看 | 一区视频免费观看 | 成人自拍网站 | 樱花影院电视剧免费 | 毛片网站免费观看 | 亚洲色鬼 | 久草视频精品在线 | 自拍偷拍麻豆 | 国产99视频在线 | 国产哺乳奶水91在线播放 | 先锋影音av中文字幕 | 亚洲av午夜精品一区二区三区 | 国产麻豆一区二区三区在线观看 | 131美女爱做视频 | 日本精品视频在线 | 九九热视 | 少妇高潮毛片色欲ava片 | 一区精品二区国产 |