特定实例

时间:2016-01-20 10:49:40

标签: google-app-engine google-cloud-endpoints google-cloud-platform

我正在使用付费帐户和常驻实例在appengine上运行应用程序。在预热请求之后的第一个端点请求非常慢(6-12秒),每个其他请求大约需要300毫秒。因此,我想将端点请求添加到由预热请求启动的servlet中。 我对此解决方案的问题是,请求不一定由最近启动的实例使用,但可以由另一个实例使用。 因此,我创建了一个特定于处于预热阶段的实例的URL:

ModulesService modulesApi = ModulesServiceFactory.getModulesService();
String currentInstance = modulesApi.getCurrentInstanceId();
String currentModule = modulesApi.getCurrentModule();
String currentVersion = modulesApi.getCurrentVersion();
String instanceUrl = "https://"+currentInstance+"-dot-"+currentVersion+"-dot-"+currentModule+"-dot-"+Constants.APP_ENGINE_URL;

网址有效,我可以访问index.html。但是,我无法访问端点。 例如,我有一个名为testEndpoint的端点,并希望访问一个名为warmup的方法: 我试着用 _ah / API / testEndpoint / V1 /预热 以及_ah / spi / com.test.backend.apis.TestEndpoint.warmup

它们都不起作用。

0 个答案:

没有答案
相关问题