Benchmarking Aria

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Non c'è stato ancora il tempo per eseguire dei benchmark appropriati su Aria. Seguono alcuni argomenti che sono stati discussi nella mailing liste maria-discuss.

Aria utilizzato per le tabelle temporanee interne

Per default viene usato Aria (invece di MyISAM) per le tabelle temporanee interne, quando le tabelle MEMORY superano le dimensioni massime e devono essere scritte su disco, oppure non è possibile utilizzare lo Storage Engine MEMORY (per esempio quando si hanno risultati temporanei con i campi BLOB). Nella maggior parte dei casi Aria dovrebbe fornire prestazioni migliori rispetto a MyISAM, ma non è sempre vero.

CREATE TABLE `t1` (`id` int(11) DEFAULT NULL, `tea` text) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert t1 select rand()*2e8, repeat(rand(), rand()*64) from t1;

Si provi a ripetere l'ultima riga fino ad ottenere 2097152 record.

Le query testate:

Q1: SELECT id, tea from t1 group by left(id,1) order by null;
Q2: SELECT id, count(*), tea from t1 group by left(id,1) order by null;
Q3: SELECT id, tea from t1 group by left(id,2) order by null;
Q4: SELECT id, count(*), tea from t1 group by left(id,2) order by null;
Q5: SELECT id, tea from t1 group by id % 100 order by null;
Q6: SELECT id, count(*), tea from t1 group by id % 100 order by null;

Risultati (tempi in secondi, i più bassi sono i migliori):

TestAria, pagine di 8KAria, pagine di 2KMyISAM
Q13.082.412.17
Q26.245.2112.89
Q34.874.054.04
Q48.207.0415.14
Q57.106.376.28
Q610.389.0917.00

La buona notizia è che, per le normali query GROUP BY che usano funzioni aggreganti, l'uso di Aria per le tabelle temporanee interne comporta un miglioramento delle prestazioni che si avvicina al 50%.

Si noti che le query Q1, Q3 e Q5 non sono comandi comuni e non viene utilizzata la somma. In questo caso le righe vengono semplicemente scritte nella tabella temporanea e non vengono modificate. Ma se vi sono funzioni aggreganti e aggiornamenti il nuovo formato di Aria velocizza quasi del 50%.

The above table also shows how the page size affects the performance. The reason for the difference is that there is more data to move back/from the page cache for inserting of keys. (When reading data we are normally not copying pages). The bigger page size however allows longer keys and fewer index levels so for bigger data sets the different should be smaller. It's possible to in the future optimize Aria to not copy pages from the page cache also for index writes and then this difference should disappear.

The default page size for Aria is 8K.

If you want to run MariaDB with MyISAM for temporary tables, don't use the configure option '--with-aria-tmp-tables' when building MariaDB.

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.