ãã®èšäºã§ã¯ãPHPãããžã§ã¯ãã§ã®SQLiteã®äœ¿çšãè©äŸ¡ãããã«ãã¹ã¬ããäœæ¥ã®æ©èœãšäœæ¥ãé«éåããæ¹æ³ã«ã€ããŠèª¬æããŸãã ããã¶ãŒãçšã-ä»ã®DBMSïŒMySQLãPosgreSQLãMS SQLãMongoDBïŒãšã®å°ããªæ¯èŒã
éå§ãã
å°ãåãŸã§ãèªåã®ãããžã§ã¯ãã®ããã¢ãŒã·ã§ã³ã³ãŒãã®ãµãŒãã¹ãèªåã§äœãããã£ãã®ã§ãã ãã©ãããã©ãŒã ã®éžæã«ãããŠãç§ã¯é·ãéçããŸããã§ããã PHPç°å¢ããããã€ããããµãŒããŒãããã®ã§ããµãŒãã¹èªäœã¯PHPã§å®å
šã«äœæã§ããŸãïŒç¹ã«æ
£ããŠããããïŒã DBMSãšããŠãSQLiteãè©ŠããŠã¿ããã£ãïŒãã ããMySQLãšPostgreSQLã¯ãµãŒããŒã«ãããã€ãããŠããŸãïŒã ãã®çç±ã¯ããæŠéãç°å¢ãžã®è»¢éïŒãã©ã«ããŒã®ã³ããŒã®ã¿ïŒãã裞ããµãŒããŒãžã®å±éãç°¡åã ããã§ãïŒPHP以å€ã¯å¿
èŠãããŸããïŒã ããã«ãããã¯ã¢ãããç°¡çŽ åãããã£ãïŒãã£ã¹ã¯ã¹ãããã·ã§ãã+çµæã®ãã¹ã©ã€ã¹ãã®åçŽãªã³ããŒã䜿çšããäºå®ã ã£ãïŒã
ãã ãã䜿çšããåã«ããã®ãœãªã¥ãŒã·ã§ã³ã®é©çšæ§ãšããã©ãŒãã³ã¹ã確èªããå¿
èŠããããŸãã
é
ãã¹ãã¯2ã€ã®ãªããžã§ã¯ãã§è¡ãããŸããã
- ã¯ãŒã¯ã¹ããŒã·ã§ã³ã Intel i5ã 12GB RAMã SSD + HDDïŒWDãã©ãã¯ïŒã Windows8ãPHPãå®è¡ããããã«OpenServerã«ãã£ãŠäœ¿çšãããŸãã
- Selectelã®ã¯ã©ãŠãã Debian 6.ãµãŒãã¹ããããŸãã ããã©ã«ãæ§æã§LAMPãã€ã³ã¹ããŒã«ããŸããã ã¡ã¢ãªæ¶è²»ãåæžããããã«ãApacheãããã«åæžããªãéãã
äºåè©äŸ¡
æåã®ããã©ãŒãã³ã¹è©äŸ¡ã®ããã«ãç°¡åãªã¹ã¯ãªãããäœæãããŸããã
<?php
ããŒãã«ã«1000ã¬ã³ãŒããé çªã«æ¿å
¥ããŸãã è²»ãããæéã枬å®ããŸãã 1ç§ãããã®æäœæ°ãèšç®ããŸãã
ååãšããŠã倧ãŸããªè©äŸ¡ã®ããã«ããã以äžã¯å¿
èŠãããŸããã
ãã©ã³ã¶ã¯ã·ã§ã³ã¯ç¹ã«äœ¿çšããŠããŸããã åæäœã¯ãç¬èªã®ãã©ã³ã¶ã¯ã·ã§ã³ã§å®è¡ãããŸãã ãã®åäœã¢ãŒãã¯ããã«ãã¹ã¬ããã¢ãŒãã§ã®ããŒã¹ã®å®éã®äœ¿çšã«è¿ããã®ã§ãã
ãããŠä»ãçµæïŒSSDã«ã€ããŠã¯ã1ç§ããã365æäœã®ã¹ã³ã¢ãç²åŸããŸããã æªããªãã
HDDã®å Žåã13ã®æäœã®ã¿ãåãåããŸããã æ²ããã§ã ãããããµãŒããŒã¯äœãšèšããŸããïŒ
ãããŠã
ãµãŒããŒã¯æºè¶³ããŠããŸãã 210æäœã
äžè¬ã«ããµãŒããŒã®ããã©ãŒãã³ã¹è©äŸ¡ã¯ããªããŸãšãã§ãã SQLiteã䜿çšããŠPHPã®ãã¹ããç¶è¡ã§ããŸãã ãã ã¡ã«ããµãŒããŒã«ã¯é«éãã¡ã€ã«ãµãã·ã¹ãã ïŒSSDïŒã䜿çšããå¿
èŠãããããšã«æ³šæããŠãã ããã
ç§ãã¡ã®å Žåãç§ãèšã£ãããã«ãã¯ã©ãŠãã¯Selectelã§äœ¿çšãããŠããŸãã SSDã¯ããã£ã¹ã¯ãšã¯ã©ãŠããã·ã³éã®ãã£ãã·ã¥ãšããŠæ©èœããŸãïŒãããã«ãããæªåé«ã
amaraoã®è©±ããç解ããããã«ïŒã
ãã«ãã¹ã¬ããæäœ
ããã§ãããŒã¹ããã«ãã¹ã¬ããã¢ãŒãã§åäœã§ãããã©ããã®è³ªåã«çããŠã¿ãŸãããã
SQLiteã«é¢ããäžé£ã®ãã°ãããèšäºãèªãïŒ
habrahabr.ru/post/149356ãŸãããã«ãã¹ã¬ããã¢ãŒãã§ã¯ãWALãã°ãæå¹ã«ããå¿
èŠãããããšãããããŸãã ããŒã¿ããŒã¹ã®åæåã«è¡ãè¿œå ããŸãïŒéããåŸïŒïŒ
$db->exec('PRAGMA journal_mode=WAL;');
ãããŠããã«ãã¹ããå®è¡ããŸãïŒSSDïŒ 1ç§ããã2000ãã©ã³ã¶ã¯ã·ã§ã³ã ã€ã³ãžã±ãŒã¿ãŒã¯5å以äžæé·ããŸããïŒ
HDDïŒ 42æäœã 3åã®æé·ã
ãµãŒããŒïŒ 1000æäœã æé·ã¯ã»ãŒ5åã§ãã
éåžžã«äºæããªãçµæã ãã°ã¢ãŒããç°¡åã«å€æŽãããšã5åã«å¢å ããŸãã
次ã®ã¹ãããã¯ããã«ãã¹ã¬ããçšã«ã¹ã¯ãªãããæžãçŽãããšã§ãã
è€æ°ã®ã¹ã¬ããïŒãµã€ãã®å®éã®æäœã«ããè¿ãïŒã§PHPã¹ã¯ãªãããæ°ååŒã³åºãããšã«ããããã«ãã¹ã¬ãããå®çŸããŸãã ãããè¡ãã«ã¯ããŠãŒãã£ãªãã£ABïŒApache BenchmarkïŒã䜿çšããŸãã
ab -n 1000 -c 10 "http://localhost:81/test/benc_sqlite.php"
çµæã®ã¹ã¯ãªããããã¹ãïŒ
<?php function openDB() {
æ¿å
¥é床ã®æž¬å®ã¯ã¹ã¯ãªããããåé€ãããŠããŸããABã¯ãããæäŸããŸãã çŸåšãåæåã¯1åã®ã¿å®è¡ãããŸãã 1ã€ã®ããŒã¿ããŒã¹ã§äœæ¥ãé²è¡äžã§ãã
ããã«ãã€ã³ã¹ããŒã«æžã¿
$db->busyTimeout(5000);
ããã¯ããã«ãã¹ã¬ããèšé²ãè©Šã¿ããšãã«ãããã»ã¹ããã®ãã¥ãŒããã°ããåŸ
æ©ãïŒ5ç§ã«èšå®ïŒããSQLITE_BUSYããšããäºå®ã«ããã«èœã¡ãªãããã«ããããã«å¿
èŠã§ãã
çµæïŒSSDïŒæ¯ç§970åã®æäœã ååãããã»ã©ã
HDDïŒ 35æäœã
ãµãŒããŒïŒããŒã«ã«ãã·ã³ãããã¹ãããå Žåã¯90æäœããµãŒããŒããABãèµ·åããå Žåã¯210æäœã SSDã§ã®å®è¡ãšã®éåžžã«å€§ããªéãã ã©ããããããã¯ã·ã¹ãã ã®æ§æã®éãã«ãããã®ã§ãïŒApacheãµãŒããŒã§ã¯ãå¯èœãªéãæå°åãããŠããŸãïŒã
ããã«ãããŒã«ã«ã€ã³ãžã±ãŒã¿ãŒãéåžžã«å€§ããå€åãããµãŒããŒã®æãã圱é¿ããããšã«æ³šæããå¿
èŠããããŸãã ç§ãããµãŒããŒãŸã§ã¯çŽ5åããã¡ãŒãã«ã
ãããã«ããã1ç§éã«æäœ90åã®æäœãè¡ã£ããšããŠããç§ã®æèŠã§ã¯ããã§ååã§ãã ããšãã°ãHabrã®å¹³åãã¥ãŒæ°ã¯1ç§ããã30åã§ãïŒãã¡ãããååŸã¯åŒ·ãããŒã¯ããããŸãããHabrã®åã«æé·ããã³æé·ããŠããŸãïŒã
å°æ¥çã«ã¯ãããŒã«ã«ãã¹ãäžã«SSDããã³HDDã®ã€ã³ãžã±ãŒã¿ãååŸãããŸãã ãããŠããµãŒããŒã®ããã«-ãªã¢ãŒããã·ã³ããã
ãµãŒããŒãšSSDã®ãã¹ãã¯ã10ã¹ã¬ããã§1000ãªã¯ãšã¹ããå®è¡ããããšã«ããè¡ãããŸãã HDDã®å Žå-10ã¹ã¬ããã§100ãªã¯ãšã¹ãã
å䜵ç
ãã¹ãã§ã¯ã1ã€ã®åçŽãªINSERTèŠæ±ããã£ãããšãæãåºãããŠãã ããã ååãšããŠãããã«åºã¥ããŠ1ã€ã®æäœãå®è¡ãããµãŒãã¹ããããšäŸ¿å©ã§ãã ããããçŸå®ãšã¯ããé¢ããŠããŸãã æ倧3ã€ã®ã¯ãšãªïŒ1ã€ã®SELECTã1ã€ã®UPDATEã1ã€ã®INSERTïŒãè€éã«ããŸãã
ãµããªãŒé¢æ°testIterationïŒ
function testIteration($db, $iteration) { $rez = $db->querySingle('SELECT count(*) FROM foo WHERE i='.$iteration); if($rez > 0) { $db->exec('UPDATE foo SET i2 = i2+1 where i='.$iteration); } return $db->exec('INSERT INTO foo VALUES ('.$iteration.', 1)'); }
SELECTã¯ãšãªããªããŠãå®è¡ã§ããããšã¯æããã§ãããããã§ããã¹ãããããæé©åã®ç«¶åã¯ãããŸããã
ææšïŒSSDïŒ 420ãªã¯ãšã¹ãããã å®è¡ããšã«ãã¬ãŒãã¯äœäžããŸãã
HDDïŒ 20件ã®ãªã¯ãšã¹ãïŒããã³ã¯ã©ãã·ã¥ïŒããã
ãµãŒããŒïŒ 65ãªã¯ãšã¹ãïŒããã³ã¯ã©ãã·ã¥ïŒããã
DBæé©å
ããã©ãŒãã³ã¹ã®äœäžãæ°ã«å
¥ããªãã£ãã ããŠããã®åé¡ãä¿®æ£ããŠã¿ãŸãããã å
·äœçã«ã¯ãã€ã³ããã¯ã¹ãè¿œå ããŸãã 1ã€ã®ãã£ãŒã«ãã®ã¿ãæ€çŽ¢ãããããã€ã³ããã¯ã¹ã«è¿œå ããŸãã
åæåã§ã次ã®è¡ãè¿œå ããŸã
$db->exec('CREATE INDEX "idx_foo" ON "foo" ("i");');
çµæïŒSSDïŒ 671èŠæ±ã ãšãŠãè¯ãã
HDDïŒ 25ã12ãªã¯ãšã¹ãã åé¡ãäœã§ãããã¯ããããŸããããçµæã¯ææšã§ã¯ãããŸããã ããããããµãŒããŒãšSSDã¯10ã¹ã¬ããã§1000ãªã¯ãšã¹ããHDD-10ã¹ã¬ããã§100ãªã¯ãšã¹ãããã¹ãããŠãããšããäºå®ãåå ã§ãã æ¡éãã«ããŒã¿ãå°ãªããªããŸãã ãããããã®ãããªåºããã¯åœ±é¿ãåããŠã¯ãããŸããã
ãµãŒããŒïŒ 60ãªã¯ãšã¹ãã
ãŸããçµæã¯ç§ã«ãšã£ãŠéåžžã«æ¥œããã§ãã ãããããã§ã«2ã€ã®åºæ¬å€æŽæäœããããŸãããã©ã³ã¶ã¯ã·ã§ã³ã¯ã©ãã«ãããŸããïŒ è¿œå ããŠãã ããïŒ
function testIteration($db, $iteration) { $rez = $db->querySingle('SELECT count(*) FROM foo WHERE i='.$iteration); $db->exec('BEGIN;'); if($rez > 0) { $db->exec('UPDATE foo SET i2 = i2+1 where i='.$iteration); } $rez = $db->exec('INSERT INTO foo VALUES ('.$iteration.', 1)'); $db->exec('COMMIT;'); return $rez; }
ãããŠåã³çµæïŒSSDïŒ 720ãªã¯ãšã¹ãããã
HDDïŒ 30ãªã¯ãšã¹ãããã ãããŠä»åã¯ãã€ã³ãžã±ãŒã¿ãŒã¯éåžžã«å®å®ããŠããŸãã
ãµãŒããŒïŒ 70ãªã¯ãšã¹ãããã
ããŒã¿ããŒã¹é害ã®æé©å
Apache Benchmarkã¯ãã¯ãšãªã®å®è¡ã«å ããŠããªã¯ãšã¹ãã®æåãç£èŠããŸãã å¿çã®é·ããååŸãããå
ã®å¿çãããé·ããŸãã¯çãå¿çã¯ãã¹ãŠãšã©ãŒãšèŠãªãããŸãã èå³æ·±ãã®ã¯ãåæ§ã®åé¡ããã¹ããããšãé·ãéçŸãå§ããããšã§ãã 1000ãªã¯ãšã¹ãã«ã€ã1ããŒã¹ã ãã«ããŸãããããã§ãã§ãã
ãã°ã§ã¯ãã¡ãã»ãŒãžãSQLite3 :: execïŒïŒïŒdatabase is lockedãã å¥åŠãªãWALã¢ãŒãããã©ã³ã¶ã¯ã·ã§ã³ãããã³ãããŒã¿ããŒã¹ã¯ããã¯ãããŠããŸããã ãœãªã¥ãŒã·ã§ã³ã¯ãSQLiteã¡ãŒãªã³ã°ãªã¹ãã§èŠã€ãããŸããïŒ
http :
//www.mail-archive.com/sqlite-users@sqlite.org/msg05525.htmlãã«ãã¹ã¬ããã¢ãŒãã§ã¯ããBEGINãã§ã¯ãªããBEGIN IMMEDIATEããŸãã¯ãBEGIN EXCLUSIVEãã䜿çšããå¿
èŠããããŸãã ãã«ãã¹ã¬ããäœæ¥çšã®ç¹å¥ãªãã©ã³ã¶ã¯ã·ã§ã³ã ãBEGIN EXCLUSIVEãã¢ãŒãã§ããã®åé¡ãçºçããããšããããŸãããããBEGIN IMMEDIATEãã¢ãŒãã§ã¯å®å
šã«è§£æ±ºãããŸããã
ãããŠä»ãæçµãã¹ãïŒSSDïŒ 700ãªã¯ãšã¹ãããã
HDDïŒ 30ãªã¯ãšã¹ãããã ããã«ãã€ã³ãžã±ãŒã¿ãŒã¯éåžžã«å®å®ããŠããŸãã
ãµãŒããŒïŒ 53ãªã¯ãšã¹ãããã å¥åŠãªããšã«ãç§ã¯çŽ70ãæåŸ
ããŠããŸãããããããããã¯é²ã§ãããå®å®æ§ã«ã€ããŠã¯èªããŸããã
ã¡ãªã¿ã«ããªã¯ãšã¹ãæ°ã®ã€ã³ãžã±ãŒã¿ã¯æéãšãšãã«å°ãäœäžããŸãã ã¯ãªãŒã³ããŒã¹ã§ã¯ãSSDã¯1000件ã®ãªã¯ãšã¹ããçºè¡ããŸãã ãããŒãã£ã-æ倧350ãåæã«ãçŽ50,000ãšã³ããªãããŒã¿ããŒã¹ã«èç©ãããŠããŸãã
ãã«ãã¹ã¬ããïŒ1ã€ã®SELECTã1ã€ã®UPDATEã1ã€ã®INSERTã¯ãšãª+ãã©ã³ã¶ã¯ã·ã§ã³+ã€ã³ããã¯ã¹ïŒãè€éã«ãããããã·ã³ã°ã«ã¹ã¬ãããã¹ããè€éãªå ŽåãSSDã§æ¯ç§1,500åã®å埩ãçºçããããšãä»ãå ãã䟡å€ããããŸãã åªåãã¹ããšããããããŸãã åæã«ãããŒã¿ããŒã¹ã倧ãããªããšãããã©ãŒãã³ã¹ã¯ãã«ãã¹ã¬ããã¢ãŒãã®å ŽåãããçŽ2åé
ããªããŸãããã¹ããç¹°ãè¿ããŠãããã«ãã¹ã¬ãããšæ¯èŒããSQLiteã®ã·ã³ã°ã«ã¹ã¬ããã¢ãŒãã®éèŠãªå©ç¹ã¯æããã«ãªããŸããã§ããã
ååãšããŠããã¹ãã¯ããªãè¯ãçµæã瀺ããŸããã ãããå ŽæãšççŸããç©è°ãããããååã«åŠã°ãªãããã«ããŸãã ããããããã§ãå人çã«ã¯ãSQLiteãšPHPã®æã®ããã©ãŒãã³ã¹è©äŸ¡ã¯ããªã瀺ãããŠããŸãã
ä»ã®DBMSãšã®æ¯èŒ
ç§ãã¡ãèŠãSQLiteã ãããããããã®æ¡ä»¶ã§ä»ã®DBMSã¯ã©ã®ããã«åäœããŸããïŒ
ãã®ãã¹ãã¯ãããŒã«ã«ãã·ã³ããã³SSDã§ã®ã¿å®è¡ãããŸãã ãã®çç±ã¯ããµãŒããŒãããããŒã«ã«ãã·ã³ã®æ¹ãDBMSãå€ãããã®ã¢ãŒãã¯ãµãŒããŒã®æäœã«ããè¿ãããã§ãã
æå
ã«ã¯ïŒSQLiteïŒv3.7.7.1ïŒãPostgreSQLïŒv9.2.1ïŒãMS SQL ServerïŒv11.0.3000.0ïŒ2012ãDeveloper EditionïŒïŒãMySQLïŒv5.5.28ïŒãMongoDBïŒv2.4.4ïŒ ã
PHPã¯ãSQLiteããã³MongoDBã®æšæºãã©ã€ããŒã䜿çšããŸããã PostgreSQLãMySQLãMS SQLã¯PDOãä»ããŠæ©èœããŸããã
ããã«ããã¹ãããããã«å€æŽããããšã«ããŸããã10,000ãªã¯ãšã¹ãã10ã¹ã¬ããã§å®è¡ãããŸãã å®éšã®çŽåºŠã®ãããããŒã¹ã¯æ¯å空ã§ããã
ããŒã¿ããŒã¹ã®åæåã¯æåã¢ãŒãã§è¡ãããŸãã åæåã«ã¯ããã£ãŒã«ãããšã«ããŒãã«ãšã€ã³ããã¯ã¹ãäœæããããšãå«ãŸããŸãã
SQLiteã®æçµã¹ã¯ãªãã <?php function openDB() {
PDOçšã®ã¹ã¯ãªããïŒPostgreSQLãMySQLãMS SQLã®æ¥ç¶æååãå€æŽãããŠããŸãïŒ <?php function openDB() {
MongoDBã®ã¹ã¯ãªãã <?php function openDB() { $conn = new Mongo('localhost'); $db = $conn->test; return $db; }
çµæïŒSQLiteïŒ 993ã¯ãšãª/ç§ã æåŸ
ãããçµæã§ãã
PostgreSQLïŒ 1ç§ããã
178,202ã¯ãšãªã ããªãå°ããã ã©ããããåé¡ã¯ããã©ã«ãèšå®ã«ãããŸãã
MS SQLïŒ 1400ã¯ãšãª/ç§ã æªããªããéåžžã«æªãã
MySQLïŒ 1490ã¯ãšãª/ç§ã ããã«ããã©ã«ãèšå®ããããŸã:)ã æåã¯1ç§ããã9件ã®ãªã¯ãšã¹ãããã£ãããšã«æ³šæããŠãã ããã localhostãžã®åŒã³åºãã127.0.0.1ã«çœ®ãæãããšåœ¹ã«ç«ã¡ãŸããã ç§ã®ç¥ãéããã·ã¹ãã å
ã®ã¢ã¯ãã£ããªIPv6ã«æ¥ç¶ãããŠããŸãã
MongoDBïŒ 1ç§ããã3173ã¯ãšãªã çŽ æŽãããçµæã NoSQLã«ã¯ãã£ãšæåŸ
ããŠããŸãããã
ççŽã«èšã£ãŠãæ¯èŒã¯æãæ£çŽã§ã¯ãããŸããã ãã¹ãã¯ããã©ã«ãèšå®ã§è¡ãããŸããã DBMSèšå®ã調æŽããããã«å¿
èŠãªç®¡çã¹ãã«ããããŸããã
MongoDBã¯äž»ã«é床æåã§ãã SQLIteã¯ä¿¡é Œæ§ã«éââç¹ã眮ããŠããŸãã ãŸããããã©ã«ãæ§æã®PostgeSQLã¯ãæå°ã®ãªãœãŒã¹æ¶è²»ã«çŠç¹ãåãããŠããŸãã ããããããã倱æã®çç±ã§ãã
UPDïŒ PostgreSQLã¯åæ¥ç¶ã奜ãŸãªããšã倧ããªç§å¯ãã§æããŠãããŸããã ãã®ãããDBMSããšã«ã·ã³ã°ã«ã¹ã¬ãããã¹ããå®æœããŸããã
ãã®ãã¹ãã§ã¯ãã·ã³ã°ã«ãã¬ã¹ã¢ãŒãã§ã®åäœæéã枬å®ããŸãã 10,000æäœãã¯ãªãŒã³ãªããŒã¿ããŒã¹ã ãã©ã³ã¶ã¯ã·ã§ã³ã§ã®1 SELECTã1 UPDATEã1 INSERTã®åœ¢åŒã®æäœã ããŒã¿ããŒã¹ã«æ¥ç¶ããã«ãã¹ã¯ãªããã§ã®é床ã®æž¬å®ïŒæåã®ãã¹ãã®ããã«ïŒã
çµæã¯æ¬¡ã®ãšããã§ããPostgreSQLïŒ 1403ã7åã®æé·ã ããã¯ãPostgreSQLã®åæ¥ç¶ã«å¯Ÿããå«æªãè£ä»ããŠããŸãã
PostgreSQLïŒfsync = offïŒïŒ 1766ãããã©ã«ãã¢ãŒãã«æ¯ã¹ãŠ4åã®1å¢å ã ãã«ãã¹ã¬ããã¢ãŒãã§ã¯ãå¢å ã¯è¡šç€ºãããŸããã§ããã
SQLiteïŒ 938ãã¹ãã¬ã³ãžã1500幎以åã ãããããã¹ãã«ééãããããŸããã
MS SQLïŒ 1993ãæé·ã¯ãã
ãŸãããéèŠã§ã¯ãããŸããã ã©ããã§40ïŒ
ïŒ1.4åã®æé·ïŒã
MySQLïŒ 2514ãæé·ã¯1.7åã§ãã
MongoDBïŒ 7603ãæé·ã¯ã»ãŒ2.5åã§ãã
çµæã¯éåžžã«èå³æ·±ããã®ã§ãã ãã®ããããµãŒããŒäžã®ããŸããŸãªDBMSã®ããã©ãŒãã³ã¹ãæ¯èŒããããšã«ããŸããã Debian 6ã䜿çšãããŠããããšãæãåºãããŠãã ãããµãŒããŒã«ã¯ãSQLiteïŒv3.7.3ïŒãPostgreSQLïŒv9.0.4ïŒãMySQLïŒv5.1.66ïŒããããŸãã ãã¹ãŠãããã©ã«ãèšå®ã«ãªã£ãŠããŸãã ABã¯ãµãŒããŒäžã§ããŒã«ã«ã«èµ·åããŸããã 10ã¹ã¬ããã§10,000ãªã¯ãšã¹ãã
çµæïŒSQLiteïŒ 1ç§ããã174ã¯ãšãªã
PostgreSQLïŒ 1ç§ããã104ã¯ãšãªã
MySQLïŒ 1ç§ããã167ã¯ãšãªã
ã芧ã®ãšãããããŒã«ã«ãã·ã³ã»ã©å€§ããªã®ã£ããã¯ãããŸããã ãã ãããµãŒããŒãSSDã䜿çšããããšãå¿ããªãã§ãã ããïŒãçŽç²ãªã圢åŒã§ã¯ãªããã¯ã©ãŠãã¹ãã¬ãŒãžã®èŠçŽ ãšããŠïŒã
ãŸãšã
ãã®çµæãPHPãšSQLiteã®çµã¿åããã¯ãè² è·ã®å°ãªããããžã§ã¯ãã«å¯ŸããŠéåžžã«æ©èœçã§ãããšèšããŸãã ããã€ãã®ç°¡åãªã«ãŒã«ã«åŸãã ãã§ååã§ãã
- WALãã®ã³ã°ã¢ãŒãã䜿çšããŸãã
- ããžãŒã¿ã€ã ã¢ãŠãã®èšå®ãå¿ããªãã§ãã ããã
- ã¬ã³ãŒãã¯ãã©ã³ã¶ã¯ã·ã§ã³ã§çµåãããŸãã ãããŠåçŽã§ã¯ãªãããããã«éå§ãã
ãããžã§ã¯ãããå°ããªããããžã§ã¯ãã«åž°ããããšãã§ããªãå Žåã¯ãããŒã¿ããŒã¹ã«SSDã䜿çšããããšã圹ç«ã€å ŽåããããŸãã
Hi-Loadã«ã€ããŠè©±ãå Žåããããè¡ã人ã¯ç§ã®ã¢ããã€ã¹ãªãã§äœããã¹ãããç¥ã£ãŠããŸãã
SQLiteãä»ã®DBMSãšæ¯èŒãããšãããã©ã«ãèšå®ã§åçã®ããã©ãŒãã³ã¹ãåŸãããŸãã ãšã«ãããSSDãã©ã€ãã䜿çšããå Žåã
åæã«ãã»ããã¢ãããšç®¡çã®å®¹æãïŒäœãæ§æããã³ç®¡çããå¿
èŠã¯ãããŸããïŒãå¥ã®ãµãŒããŒãžã®è»¢éã®å®¹æãïŒåçŽãªã³ããŒãšè²Œãä»ãïŒãSQLiteã«ããã€ãã®å©ç¹ããããããŸãã äž»ã«éçºè
åãã PHPã§SQLiteã䜿çšããã«ã¯ãPHPèªäœã®ã¿ãå¿
èŠã§ãã