speed up the insertion of Excel data in Mysql with PHP/laravel
Hi everyone, I import Excel data into a MySQL database with PHP/Laravel. The problem is that it takes time. With a file of 55MB (+500,000 lines) the work is still in progress. Using queues, some tasks fail.Knowing that I want to import more than 10GB of data, how do I optimize it? How to harness the full power of processors? I tell myself when I see the activity of the processors that not all of them are used. NB: I have more than 180GB of Ram and 50-60 CPU.
Thank you for the time you will devote to this post.
Hello ... well ... you speak about 180 Gb RAM and 50-60 CPU ... and on the other side a little database (55 Mb / 500 000 lines). I don't understand why you would need so much resources for a little database. I have already imported such files in my database, yes it takes time, and I have only 4 Gb RAM and 2 CPU ;).
Can you be more precise about the performances you need ?
@cirecodeur I'm not sure that the answer is in Laravel. Perhaps you need some specific material architecture to dispatch the load. Have you thought about AWS ?
You can use multiple processes perhaps (you would need to implement it yourself using spatie/async or similar) but my guess would, that you database would be a bottleneck
@Sinnbeck THANK your answer. I used maatwebsite/excel package. My real problem is to work on reducing import time. I'm supposed to be working more on reducing import time.
@Tray2 hello, It's something regular for end user. they can upload more than 1GB of Excel(csv, xlx ...) files and the system will import to database. 1 file = 1 table