Spring应用在数据过滤时性能较低。

huangapple go评论61阅读模式
英文:

Spring application low performance when filtering data

问题

Sure, here's the translated content:

  • 我已在B2应用引擎中创建了Spring应用程序,我可以在日志中看到应用程序完成数据过滤(在唤醒应用程序后)需要1秒的时间。而在我的本地机器上,它只需要10毫秒。数据量非常小,逻辑也不复杂,只是项目的开始阶段。

所以我的问题是,我的应用引擎实例是否缺乏某些资源或其他什么东西?也许我缺少一些配置或JAVA选项,因为我现在使用的是默认设置。也许有人遇到过类似的性能问题。

更新。我尝试使用了B1、B2、B4实例。结果都一样。感觉应用程序的资源非常少。

问题在我创建计算引擎虚拟机后得到解决。在虚拟机中,我运行了带有相同应用程序的Docker镜像。现在它工作得很好。响应也很快。

我很想继续使用应用引擎,但仍然无法弄清楚是什么原因导致这个问题。我使用了谷歌教程中app.yaml的所有默认设置,没有其他附加选项。

英文:
  • I have created Spring application in app engine B2, I can see in logs
    that application takes 1s to complete data filtering(after wakening
    application up). When in my local machine it takes 10ms. Data size is
    really small and logic is not so complex, just begining of the
    project.

So my questions is it possible that my app engine instance are lacking of some resources or smth? Maybe I am lacking of some configuration or JAVA OPTIONS, because now I use default. Maybe someone has faced similar permormance issues.

Update. Again I have tried to use B1 B2 B4 instances. Same results. Feels like the applications has really small amount of resources.

Problem solved, when I created Compute Engine VM. In virtual machine I have running docker image with the same application. And now it works fine. Responses are great.

I would love to use App Engine, but still cannot figure out what causes this. I use all default settings of app.yaml from google tutorials with no additional options.

答案1

得分: 1

Here's the translated content:

慢速可能是由于CPU数量较少或内存不足引起的。您可以尝试以下 app.yaml 配置。您可以将其放置在 src\main\appengine 文件夹中。要运行它,您可以使用以下命令:

mvn clean package appengine:deploy -Dapp.deploy.projectId=**projectIdName**
runtime: java
env: flex
# 应用资源
resources:
  cpu: 4
  memory_gb: 16
  disk_size_gb: 200
# 自动扩展
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2
  cool_down_period_sec: 120
  cpu_utilization:
    target_utilization: 0.6
英文:

Slowness may come because of less number of CPU or less memory. You can try below app.yaml.
You can place it in src\main\appengine folder. To run it, you can use
mvn clean package appengine:deploy -Dapp.deploy.projectId=projectIdName

runtime: java
env: flex
# Application Resources
resources:
  cpu: 4
  memory_gb: 16
  disk_size_gb: 200
# Automatic Scaling
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2
  cool_down_period_sec: 120
  cpu_utilization:
    target_utilization: 0.6

huangapple
  • 本文由 发表于 2020年8月14日 19:10:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63411639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定