为Google Cloud App Engine灵活环境指定区域(Specify Zone for Google Cloud App Engine Flexible Environment)
问题:有没有办法为Google Cloud App Engine灵活环境指定区域? 如果没有,有哪些替代方案?
上下文:我正在使用App Engine来编写和读取Bigtable。 但是我发现性能有所下降,在调试过程中,我发现Google的文档说明:
网络连接存在问题。 网络问题可能会降低吞吐量并导致读取和写入时间比平时长。 特别是,如果您的客户端未与Cloud Bigtable集群在同一区域中运行,您将看到问题。
就我而言,我的客户处于不同的区域,通过将其移动到同一区域,性能大幅提升。 但是,性能问题仍然存在,文档中的建议是将客户端放在与Bigtable相同的区域中。
我还考虑使用容器引擎或计算引擎,它更容易指定区域,但我希望继续使用App Engine来实现其自动缩放功能和托管服务。
Question: Is there a way to Specify Zone for Google Cloud App Engine Flexible Environment to reside in? If not, what are the alternatives?
Context: I'm having a setup where I use App Engine to write and reads to Bigtable. However I noticed a performance decrease, and during the debugging, I found a documentation from Google stating:
There are issues with the network connection. Network issues can reduce throughput and cause reads and writes to take longer than usual. In particular, you'll see issues if your clients are not running in the same zone as your Cloud Bigtable cluster.
In my case, my client is in a different region, by moving it to the same region had a huge increase in performance. However the performance issue still exist, and the recommendation from the documentation is to put client in the same zone as Bigtable.
I also considered using Container engine or Compute Engine where it is easier to specify the zone, but I want stay with App Engine for its autoscale functionality and managed services.
原文:https://stackoverflow.com/questions/46793277
最满意答案
我解决了这个问题。 我将
$scope.chartOptions
传递给一个函数,根据一些其他参数向它添加属性。 我正在为几个图表执行此操作,因此我克隆了$ scope.chartOptions并修改了它的克隆版本,最终将这些克隆传递给图表的构造函数。问题:为了克隆对象,我正在做一个对象的浅拷贝,如这里所解释的,集合的浅拷贝是集合结构的副本,而不是元素。 出于这个原因,我失去了onProgress和onComplete函数。
所以我使用了
angular.copy($scope.chartOptions)
。I solved the issue. I was passing
$scope.chartOptions
to a function to add attributes to it depending on some other parameters. I was doing this for several charts, so I cloned $scope.chartOptions and modified the cloned versions of it, to finally pass these clones to the charts' constructor.The problem: In order to clone the object I was doing a shallow copy of the object, and as explained here, a shallow copy of a collection is a copy of the collection structure, not the elements. For this reason I was losing the onProgress and onComplete functions.
So I used
angular.copy($scope.chartOptions)
.
相关问答
更多-
如何在chart.js中的Graph和X / Y-Scale之间添加填充?(How to add padding between Graph and X/Y-Scale in chart.js?)[2022-07-12]
实际上,您并不需要链接解决方案的所有复杂性,因为 您打算不显示轴线(我从图像中看到您将设置图表背景和比例颜色相同)和 您已经对比例开始值和结束值进行了硬编码(我假设您知道数据的值范围并且不需要自动计算) - 如果此条件不适合您,请参阅替代解决方案 有了这些警告,你只需要进行一些更改(只需在选项名称上按Ctrl + F找到要替换的行) scaleSteps: 5, // Number - The value jump in the hard coded scale scaleStepWidth: 50, // ... -
有一个onAnimationComplete选项,您可以指定在动画完成后运行内容。 请参阅文档的此部分 。 例 var ctx = document.getElementById("chart").getContext("2d"); var myLine1 = new Chart(ctx).Line(lineChartData1, { onAnimationComplete: function() { alert('animation complete') } }); 小提 ...
-
基本上,在完成动画绘制文本之前,您需要检查特定数据集是否隐藏。 要完成此操作,您只需使用以下内容替换onComplete函数即可... "onComplete": function() { var chartInstance = this.chart, ctx = chartInstance.ctx; ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.g ...
-
有一个新的数据集选项spanGaps ,允许连接点与它们之间的间隙。 Github提交参考: https://github.com/chartjs/Chart.js/commit/77357e57d6f5ae44ba10bf22b06219850df4df5f There is a new dataset option spanGaps that allows to connect dots with gaps between them. Github commit for reference: https ...
-
如何使用Chart.js在堆积条形图中显示内联值?(How to display inline values in a stacked bar chart with Chart.js?)[2022-07-17]
使用名为chartjs-plugin-datalabels的Chart.js插件可以轻松实现这一点 。 以下是此插件需要设置的最小选项,以显示堆叠条形图内部(中间)的值: options: { //your chart options plugins: { datalabels: { display: true, align: 'center', anchor: 'center' } } } 虽然,您可以使用大量其他 ... -
这是因为旋转后您没有恢复画布状态。 您应该将其恢复到外部,而不是在if语句中恢复它,如下所示: ... if (bar._datasetIndex == 0) { ctx.fillText(bar._model.label, 0, 0); } ctx.restore(); //<- restore canvas state ... 另外,你应该更好地创建一个插件 (以防止标签闪烁),而不是在动画完成时绘制标签。 这是JSFiddle的工作示例 This is because you are not ...
-
对于这种情况,你应该使用“onProgress”而不是“onComplete”。 试试这个代码: animation: { onProgress: function () { var chartInstance = this.chart, ctx = chartInstance.ctx; ctx.textAlign = 'center'; ctx.fillStyle = "rgba(0, 0, 0, 1)"; ...
-
我解决了这个问题。 我将$scope.chartOptions传递给一个函数,根据一些其他参数向它添加属性。 我正在为几个图表执行此操作,因此我克隆了$ scope.chartOptions并修改了它的克隆版本,最终将这些克隆传递给图表的构造函数。 问题:为了克隆对象,我正在做一个对象的浅拷贝,如这里所解释的,集合的浅拷贝是集合结构的副本,而不是元素。 出于这个原因,我失去了onProgress和onComplete函数。 所以我使用了angular.copy($scope.chartOptions) 。 ...
-
您可以扩展图表以从x轴中删除不需要的点,如此(改编自https://stackoverflow.com/a/31606933/360067 ) Chart.types.Line.extend({ name: "LineAlt", initialize: function (data) { Chart.types.Line.prototype.initialize.apply(this, arguments); if (this.options.every) ...
-
您的代码期望主代码中的ctx值与您的扩展名不同。 在您的主代码中,它看起来像一个DOM节点,在您的扩展中,您将它用作上下文。 只需添加 var ctx = this.chart.ctx; 在Chart.types.Line.prototype.draw.apply(this, arguments);之后Chart.types.Line.prototype.draw.apply(this, arguments); 它应该工作。 如果没有,检查您的主代码变量是否都使用正确的值定义( start , end ...