Data that is accessed often can be stored in Mnesia (RAM + disc), like categories and products.
Data that is seldom used, like orders, can be stored in Postgres.
To just a get an idea of the difference in speed between Mnesia and Postgres I wrote a very very basic (and not so basic-in-reality) benchmark. 100 000 writes inserting an id and a name (the same name) and the same amount of reads.
Name ips average deviation median 99th %
4mnesia_read 18.23 0.0549 s ±8.93% 0.0535 s 0.0675 s
3mnesia_write 2.32 0.43 s ±3.69% 0.43 s 0.45 s
2ecto_read 0.0533 18.76 s ±0.00% 18.76 s 18.76 s
1ecto_write 0.0358 27.90 s ±0.00% 27.90 s 27.90 s
Writing something that interacts conveniently with Mnesia, which is just a key-value-storage, might take some time. But to get such a speed boost should be worth quite a few lines of code.
Later on I plan to perform a more reality-based benchmark, when a products-and-categories-in-Mnesia-layer has been written.
Later on I plan to perform a more reality-based benchmark, when a products-and-categories-in-Mnesia-layer has been written.
No comments:
Post a Comment