- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我了解在 Java 虚拟机 (JVM) 中,可能需要预热,因为 Java 使用延迟加载过程加载类,因此您希望确保在启动主要事务之前初始化对象。我是一名 C++ 开发人员,不必处理类似的要求。
但是,我无法理解的部分如下:
以一个应用程序为例,该应用程序期望通过套接字接收消息,并且交易可能是新订单、修改订单和取消订单或交易确认。
请注意,该应用程序涉及高频交易 (HFT),因此性能至关重要。
最佳答案
Which parts of the code should you warm up?
通常,您无需执行任何操作。但是,对于低延迟应用程序,您应该预热系统中的关键路径。你应该有单元测试,所以我建议你在启动时运行它们来预热代码。
即使您的代码已经预热,您也必须确保您的 CPU 缓存也保持温暖。在阻塞操作后,您可以看到性能显着下降,例如网络 IO,最长 50 微秒。通常这不是问题,但如果您想在大多数时间保持在 50 微秒以下,这在大多数情况下都会成为问题。
注意:预热可以让 Escape Analysis 启动并将一些对象放在堆栈上。这意味着不需要优化此类对象。最好在优化代码之前对应用程序进行内存分析。
Even if I warm up some parts of the code, how long does it remain warm (assuming this term only means how long your class objects remain in-memory)?
没有时间限制。这取决于 JIt 是否检测到它在优化代码时所做的假设是否不正确。
How does it help if I have objects which need to be created each time I receive an event?
如果您想要低延迟或高性能,您应该创建尽可能少的对象。我的目标是产生低于 300 KB/秒的速度。使用此分配率,您可以拥有一个足够大的 Eden 空间,以便每天进行一次次要收集。
Consider for an example an application that is expected to receive messages over a socket and the transactions could be New Order, Modify Order and Cancel Order or transaction confirmed.
我建议您尽可能重复使用对象,但如果它在您的分配预算之内,则可能不值得担心。
Note that the application is about High Frequency Trading (HFT) so performance is of extreme importance.
您可能对我们用于不同投资银行和对冲基金的 HFT 系统的开源软件感兴趣。
My production application is used for High frequency trading and every bit of latency can be an issue. It is kind of clear that at startup if you don't warmup your application, it will lead to high latency of few millis.
您可能特别对 https://github.com/OpenHFT/Java-Thread-Affinity 感兴趣因为这个库可以帮助减少关键线程中的调度抖动。
And also it is said that the critical sections of code which requires warmup should be ran (with fake messages) atleast 12K times for it to work in an optimized manner. Why and how does it work?
代码是使用后台线程编译的。这意味着即使一个方法可能有资格编译为 native 代码,但这并不意味着它已经这样做了,尤其是在编译器已经很忙的启动时。 12K不是不合理,但可能会更高。
关于java - 为什么JVM需要预热?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36198278/
阅读文档时:https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots#swap-operation-steps
我正在使用 Leiningen 在 Clojure 中创建一个项目。我必须对这个项目进行基准测试。我开始明白我必须预热我的 JVM。我已经进行了提前编译,这是否意味着我不必预热我的 JVM? 我知道调
我们有一个 Kubernetes 服务,其 pod 需要一些时间来预热第一个请求。基本上,第一个传入请求将从 Redis 读取一些缓存值,这些请求可能需要更长的时间来处理。当这些新创建的 pod 准备
我正在尝试消除(或至少最小化)我的 .NET 应用程序的启动/预热时间。尽管这是一个普遍关注的问题,但我不太确定如何做到这一点。 关于 .NET 应用程序启动缓慢的问题有很多。这些很容易通过池回收、工
如何预热 Maven 测试的依赖缓存?例如。 mvn test -DskipTests 下载一些依赖项,但不是全部,例如一些 maven surefire 插件依赖项只能通过 mvn test 下载。
如果我正在设计排序算法测试,我可以这样做以避免 JVM 预热吗?谢谢! double count = 0; double start, end; for(int r = 0; r < warmup;
我想要一个 java 应用程序,它运行 Scalabench 的不同基准测试.我想确保 JVM 在开始测量基准运行时长之前已预热。我应该如何从我的 Java 应用运行这些基准测试? 我想到的第一件事是
除了使用以下命令外,还有其他方法可以预热 PIOPS EBS 卷吗? sudo dd if=/dev/xvdf of=/dev/null bs=1M 随着 EBS vol 的大小增加,上述命令似乎需要
此消息来源说初始化: https://support.microsoft.com/en-us/help/2843964/application-initialization-module-fails-
我们已经使用 IIS 7.5 的应用程序初始化模块已经有一段时间了,它总是工作得很好。 但是,我们刚刚开始实现 SSL,它似乎与热身产生了冲突。我已经做了很多研究,但到目前为止还没有解决方案。 基本上
我试图使用IIS 7.5应用程序初始化扩展为我的Web应用程序配置预热过程。我正在采用这种方法来最大程度地减少由应用程序池回收引起的速度下降,这是一个问题。 我想要的是在不重新映射其他任何请求的情况下
我有一个托管在 IIS 上的 .net core (3.1) Web 应用程序。我无法弄清楚如何在第一个请求之前运行一段代码。我已完成以下操作: 设置应用池的“启动模式”=“AlwaysRunning
我有一个托管在 IIS 上的 .net core (3.1) Web 应用程序。我无法弄清楚如何在第一个请求之前运行一段代码。我已完成以下操作: 设置应用池的“启动模式”=“AlwaysRunning
我是一名优秀的程序员,十分优秀!