Appengine实例小时数与CPU时间 [英] Appengine Instance Hours vs. CPU Time

查看:85
本文介绍了Appengine实例小时数与CPU时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用当前每天使用大约2小时的CPU时间,但使用超过100个实例小时。这是否意味着每个实例平均只能工作2%?

My app currently uses about 2 hours of CPU time a day, but uses over 100 instance hours. Does this mean that each instance is, on average, only working 2% of the time?

我想优化我的系统以尽可能少使用实例时间。什么是合理的使用百分比目标?

I want to optimize my system to use as few instance hours as possible. What's a reasonable usage percentage to aim for?

推荐答案

是的,这大致是您的平均CPU使用率。

Yes, that is roughly your average CPU utilization.

为减少实例小时数并提高CPU利用率,您可以做的第一件事是并行化代码,尽可能多地同时完成多项工作。像异步URLFetch Async Datastore API 将对此有所帮助。 NDB库虽然仍然是实验性的,但可以编写使用RPC并行性的代码很容易。

The number one thing you can do to reduce instance hours and improve CPU utilization is to parallelize your code, doing as much work simultaneously as possible. Tools like Asynchronous URLFetch and the Async Datastore API will help with this. The NDB library, though still experimental, makes writing code that uses RPC parallelism a lot easier.

识别这种优化的最佳方式是运行 App Stats ,然后检查您花费最多时间等待的RPC,看看您是否可以在做其他事情的同时你等待它们完成。

The best way to identify the low-hanging fruit for this sort of optimization is to run App Stats on your app, and examine what RPCs you spend the most time waiting for, and see if you can do other things while you wait for them to complete.

你应该预期的利用率取决于你正在做的事情。如果你大部分是CPU绑定的话,你可以得到100%,或者如果你的应用完全是串行的,你可能无法提高2%。

The utilization percentage you should expect depends hugely on what you're doing. You could get 100% if you're mostly CPU bound, or you might not be able to improve on 2% if your app is entirely serial in nature.

这篇关于Appengine实例小时数与CPU时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆