简体   繁体   English

使用LoopBack和Kerberos的Node.js应用程序的性能峰值

[英]Performances spikes on Node.js application using LoopBack and Kerberos

Our API's implemented with Node.js using the LoopBack framework retrieving data from HBase using Kerberos as authentication layer show inexplicable performance spikes of 5000 ms and 10000 ms with the bulk of the requests returning a result within 1000 ms. 我们的API通过使用LoopBack框架,使用Kerberos作为身份验证层从HBase检索数据的Node.js实施,显示出5000 ms和10000 ms的莫名其妙的性能峰值,大部分请求在1000 ms内返回了结果。

performance spikes 性能高峰

Our applications are running as a Docker container on OpenShift. 我们的应用程序在OpenShift上作为Docker容器运行。 We are running Node.js version 6.13 and our OS is Red Hat Linux 7.3 我们正在运行Node.js版本6.13,我们的操作系统是Red Hat Linux 7.3

We tried pinpointing the issue performing the following actions: 我们尝试通过执行以下操作来查明问题所在:

  1. Run with and without Kerberos. 使用和不使用Kerberos均可运行。 Although running the application with Kerberos seems to worsen the spikes running the application without Kerberos shows more or less the same patterns. 尽管使用Kerberos运行应用程序似乎使运行情况恶化,但没有Kerberos的运行峰值显示出几乎相同的模式。 Therefore we ruled out Kerberos as the source of the problem. 因此,我们排除了Kerberos作为问题的根源。

  2. Run the application locally instead of in OpenShift. 在本地而不是在OpenShift中运行该应用程序。 The spikes occur both locally as in OpenShift. 尖峰和OpenShift一样都在本地发生。 Therefore we ruled out OpenShift as the source of the problem. 因此,我们排除了OpenShift作为问题的根源。

  3. Create the application with and without LoopBack. 创建带有和不带有LoopBack的应用程序。 The spikes occur on both applications and therefore we also ruled out LoopBack as the source of the problem. 尖峰出现在两个应用程序上,因此我们也排除了LoopBack作为问题的根源。

  4. Using Node.js (with LoopBack) with an in-memory database. 在内存数据库中使用Node.js(带有LoopBack)。 When using an in-memory database and not performing any external requests we don't see spikes anymore. 当使用内存数据库并且不执行任何外部请求时,我们不再看到峰值。 From this we concluded that Node.js itself is not the problem but something seems to be going on using the Node.js external requests. 由此得出的结论是,Node.js本身不是问题,但使用Node.js外部请求似乎正在发生某些事情。

We are looking for suggestions what might cause our performance issues or where we could investigate further. 我们正在寻找可能导致性能问题或在哪里进行进一步调查的建议。

We have solved this issue, it did turn out to be the way NodeJS handles DNS lookup requests. 我们已经解决了这个问题,事实证明这是NodeJS处理DNS查找请求的方式。

At first we did not believe this could be the case, no other application had connectivity issues and launching the same requests using curl resulted in no time-out's. 最初,我们不认为可能是这种情况,没有其他应用程序出现连接问题,并且使用curl启动相同的请求不会导致超时。 After using systrace we noticed that one out of every 100 DNS lookup requests took an awful long time, coinciding with the spikes we saw earlier. 使用systrace之后,我们注意到每100个DNS查找请求中就有一个花费了很长时间,这与我们之前看到的峰值相吻合。 After adding the IP addresses to the hosts file on each machine running our Node code the issue was resolved. 将IP地址添加到运行我们的节点代码的每台计算机上的主机文件中后,此问题已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM