Я пытаюсь прочитать ключ Cloud Bigtable через Google Cloud Functions с помощью Node.JS, и я могу его прочитать, но время выполнения функции Cloud составляет более 1500 мс.
Я слышал, что Cloud Bigtable очень быстр с точки зрения извлечения данных, но в этом случае этого не происходит.
Может ли кто-нибудь помочь мне с этим, что я делаю здесь не так?
Я попытался загрузить библиотеку и объект Bigtable глобально:
/**
* Responds to any HTTP request.
*
* @param {!express:Request} req HTTP request context.
* @param {!express:Response} res HTTP response context.
*/
// Imports the Google Cloud client library
const Bigtable = require('@google-cloud/bigtable');
const TABLE_ID = '';
const COLUMN_FAMILY_ID = '';
const COLUMN_QUALIFIER = '';
const INSTANCE_ID = '';
// Creates a Bigtable client
const bigtable = new Bigtable();
// Connect to an existing instance:my-bigtable-instance
const instance = bigtable.instance(INSTANCE_ID);
// Connect to an existing table:my-table
const table = instance.table(TABLE_ID);
const filter = [{
family: COLUMN_FAMILY_ID,
}, {
column: COLUMN_QUALIFIER
}];
exports.helloWorld = (req, res) => {
console.log("started");
(async () => {
try {
var query_params = req.query;
var rowkey = query_params.key;
console.log("before query");
const [singleRow] = await table.row(rowkey).get({filter});
console.log("after query");
res.status(200).send();
} catch (err) {
// Handle error performing the read operation
console.error(`Error reading rows :`, err);
}
})();
};
Я разместил консольные журналы в разных точках, а время до и после запроса имеет разрыв около 1500 мс.