简体   繁体   English

Google Cloud SQL - 缓慢的INSERT性能

[英]Google Cloud SQL - slow INSERT performance

In a table with 10 columns, no indexes except the primary key on a single numeric column, and a single INSERT INTO statement with 2,500 rows, it takes between 40 to 60 seconds to do the insert (single transaction ... approx 40 seconds at 1:00 AM and 60 seconds during normal business hours). 在包含10列的表中,除了单个数字列上的主键和没有2,500行的单个INSERT INTO语句之外没有索引,执行插入需要40到60秒(单个事务...大约40秒时间正常营业时间凌晨1:00和60秒)。

I'm using com.mysql.jdbc.GoogleDriver and a D0 instance. 我正在使用com.mysql.jdbc.GoogleDriver和D0实例。

I find it strange that when i use the local dev environment and connect remotely through it, using the same code exactly (only diff is remote connection) those same inserts only take about 10 seconds rather than 40 to 60 seconds. 我发现奇怪的是,当我使用本地开发环境并通过它远程连接时,使用完全相同的代码(只有diff是远程连接),这些相同的插入只需要大约10秒而不是40到60秒。 So something is slowing down a lot when it moves to app engine... 所以当它转移到app引擎时,某些东西正在减速很多......

Is there any way to improve the App Engine deployed performance? 有没有办法改善App Engine部署的性能?

EDIT: I've just added code examples. 编辑:我刚刚添加了代码示例。 Note that when running the dev server and accessing cloud SQL, this runs pretty quickly (10 seconds in last test). 请注意,在运行开发服务器并访问云SQL时,运行速度非常快(上次测试时为10秒)。

Here is the create table statement: 这是create table语句:

CREATE TABLE import_test ( import_test_ID bigint NOT NULL COMMENT 'AUTOKEY' , INDEX (import_test_ID) , first_name varchar(30) COMMENT '' , last_name varchar(30) COMMENT '' , address varchar(60) COMMENT '' , city varchar(30) COMMENT '' , state varchar(10) COMMENT '' , zip varchar(15) COMMENT '' ,  PRIMARY KEY (import_test_ID)  ) COMMENT '' 

and the very long insert (approx 3,100 rows) which I've trimmed down here: 和我在这里修剪过的非常长的插入物(大约3,100行):

INFO: INSERT INTO import_test (import_test_ID, first_name, last_name, address, city, state, zip) VALUES (?,?,?,?,?,?,?), (?,?,?,?,?,?,?), (?,?,?,?,?,?,?), (?,?,?,?,?,?,?), ... 

您可以将复制设置为异步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM