Daily Archives: February 13, 2016

Intensive write: Mysql vs Redis

This is another test on mysql and redis write speed. The test is easy. Keep updating a counter in mysql and redis for 10s. And see how many times it can update. Mysql uses InnoDB engine. Each update commits.

redis_mysql2

redis_mysql

Result shows that redis has better update performance. A redis server can handle up to 40K update per second.

Redis / Mysql stays in same machine with 2.9GHz CPU, 4GB memory.

You can find my testing code on github: link

Stored Procedure vs ETL Tool

This is a test for stored procedure and ETL tool kettle. The test is very easy: insert [1, 2, …, 10000] numbers to a table in Mysql(InnoDB). And I got below result.

kettle_sp2

kettle_sp3

kettle_sp

The conclusion is that performance between stored procedure and etl tool doesn’t differ more than 10 times. This is relatively fine if we are not too picky about performance.

———————————–

Code to insert rows in mysql:

DELIMITER $$

USE `test`$$

DROP PROCEDURE IF EXISTS `insert_test`$$

CREATE DEFINER=`root`@`%` PROCEDURE `insert_test`()
BEGIN
DECLARE a INT DEFAULT 0;
SET a = 1;

WHILE a <= 10000 DO
INSERT INTO test VALUES(a);
SET a = a + 1;
END WHILE;

END$$

DELIMITER ;

SET autocommit = 0;
CALL test.`insert_test`();
COMMIT;