Am 11.03.2016 um 05:10 schrieb Jerry Lin:
Hi Kristian, In local server ,I also use -h <ip> option to login my mariadb not localhost . If this ip is on local server ,does the mariadb can transfer the ip to local soket ?
no, only when you use "localhost" and not "127.0.0.1"
If not ,I think the command " mysql -h db1 -utest -ptest -D IST < insert_file.sql" should not has gap ?
and how do the data of "insert_file.sql" come to the server? besides that a local interface is always faster then network try it out - your own IP on a linux machine is handeled by the loopback device - proven by iptables rules for "-i lo" hit also when call the 192.168.2.2 address
2016-03-10 22:46 GMT+08:00 Kristian Nielsen <knielsen@knielsen-hq.org <mailto:knielsen@knielsen-hq.org>>:
林澤宇 <jerry08291021@gmail.com <mailto:jerry08291021@gmail.com>> writes:
> I use a file include 100000 insert command statements to test the insert > performanc . > On local server ,the Mariadb spent about 20 second to insert data;but on > remote server ,the MariaDB spent about 30 second to insert data .
> Why the MariaDB has about 10 second gap ? > Maybe the network should to cause some latancy ,but the time should not > have so long .
Why do you think 10 seconds is unexpected?
If you are sending 100000 individual queries from a single client thread, that is 100000 network roundtrips. Extra 10 seconds for that seems reasonable, in fact it sounds quite fast to me (0.1 ms network roundtrip).
If you want better performance on remote server, try sending many statements in one roundtrip using multi-statement protocol, or running many queries in parallel from the client to overlap the roundtrips.