Which is faster / more efficient - lots of little MySQL queries or one big PHP array?

前端 未结 6 1079
离开以前
离开以前 2021-02-06 01:55

I have a PHP/MySQL based web application that has internationalization support by way of a MySQL table called language_strings with the string_id,

6条回答
  •  萌比男神i
    2021-02-06 02:26

    I am currently at the point in my site/application where I have had to put the brakes on and think very carefully about speed. I think these speed tests mentioned should consider the volume of traffic on your server as an important variable that will effect the results. If you are putting data into javascript data structures and processing it on the client machine, the processing time should be more regular. If you are requesting lots of data through mysql via php (for example) this is putting demand on one machine/server rather than spreading it. As your traffic grows you are having to share server resources with many users and I am thinking that this is where getting JavaScript to do more is going to lighten the load on the server. You can also store data in the local machine via localstorage.setItem(); / localstorage.getItem(); (most browsers have about 5mb of space per domain). If you have data in database that does not change that often then you can store it to client and then just check at 'start-up' if its still in date/valid.

    This is my first comment posted after having and using the account for 1 year so I might need to fine tune my rambling - just voicing what im thinking through at present.

提交回复
热议问题