Answer the question
In order to leave comments, you need to log in
You need to parse json into a database. Critical speed. Which language and framework to choose?
You need to parse json into a database. There is a lot of data and it is critical that this json be parsed as quickly as possible. Which language and framework to choose?
The main thing is the speed of parsing.
Now it works on php laravel and on php Yii 2 everything is saved to the mysql database. Several different parsers.
And in my opinion not the fastest solution. Please advise options.
Answer the question
In order to leave comments, you need to log in
If the json parser slows down:
- write it yourself, when the format is fixed, you can get by with regular expressions, this is most often an excellent compromise on development / execution speed, otherwise you can use a character-by-character picker on c / c ++ (not the fact that you will get faster than regular expressions).
- do not try to parse the entire string with one expression, divide it into parts, most often everything is done by searching for a substring / character.
- do not collect data intermediately into associative arrays, send everything at once to sql queries
If writing to the sql database slows down:
- disable transactions or make them large, collecting a group of data between begin .. comit
- turn off indexes, sometimes it gives a huge increase in write speed (including foreign key), after adding data you will return
- temporarily place the tablespace files of the database on the fastest disk, even to the detriment of reliability, for example, in tmpfs / ramdisk RAM (there are some peculiarities, by default, it does not use a virtual machine, but under windows imdisk can), or look for where you can enable forced write cache (this is not easy)
Later, when the database import is over, stop the database and transfer the files manually, changing the symlinks to directories
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question