jadero
02-03-2002, 06:10 PM
Grab a coffee; this is a long one :)
I have a javascript library (patience, I'll get to the PHP stuff in a moment), which depends on finding its data in arrays. Those arrays are currently a series of stand-alone files (i.e. contains only the array declaration and the assignment of the various elements). Since the data does change over time, I built a MySQL database to handle the data, thus simplifying the data updates. That part is all working fine, but I'm having trouble deciding what to do next.
As I see it, I've got two choices:
1. I can query the relevant table and use PHP to output actual disk files that are identical to my current JS files. This is attractive for a couple of reasons. First, it means that I don't have to make any other changes to my site coding. Second, since the data actually changes quite slowly over time, having 'static' files that are rewritten occassionally strikes me as being an efficient use of memory, processor, and MySQL resources, while little or no effect on HTTP server and I/O resources (other than actual disk space).
2. I can (I think!) modify the 'data loading routine' to actually build the JS array on the fly with 'echo()' statements. This is attractive for a couple of reasons. First, I don't have to worry about trying to figure out how to actually write a file (which looked simple enough, but has proven to be a little more complicated than I expected). Second, if I ever find the need to build advanced search functions instead of depending on a few pre-defined listings, the 'on-the-fly' method will need to be built anyway.
So here's what I need to know:
1. Can I use PHP on FQ to write files derived from MySQL queries to my web-folders? Are there security issues associated with this (either mine or FQs) that should keep me awake at night?
2. Is there really a meaningful performance difference between hitting a static file and pulling a query? I expect that a lot has to do with file/set size, so I'll give you the basics: Maximum 300 rows in a single result set, with a maximum row length of 300 bytes (I have medians and averages as well, but there is also a trend that suggests I should be prepared to have most of the results max'd out!).
3. Is there anything I need to know that I don't know I need to know (if you know what I mean %) ) or anything else you need to know in order to provide sound advice?
Thanks for any help you folks can provide.
Ron
I have a javascript library (patience, I'll get to the PHP stuff in a moment), which depends on finding its data in arrays. Those arrays are currently a series of stand-alone files (i.e. contains only the array declaration and the assignment of the various elements). Since the data does change over time, I built a MySQL database to handle the data, thus simplifying the data updates. That part is all working fine, but I'm having trouble deciding what to do next.
As I see it, I've got two choices:
1. I can query the relevant table and use PHP to output actual disk files that are identical to my current JS files. This is attractive for a couple of reasons. First, it means that I don't have to make any other changes to my site coding. Second, since the data actually changes quite slowly over time, having 'static' files that are rewritten occassionally strikes me as being an efficient use of memory, processor, and MySQL resources, while little or no effect on HTTP server and I/O resources (other than actual disk space).
2. I can (I think!) modify the 'data loading routine' to actually build the JS array on the fly with 'echo()' statements. This is attractive for a couple of reasons. First, I don't have to worry about trying to figure out how to actually write a file (which looked simple enough, but has proven to be a little more complicated than I expected). Second, if I ever find the need to build advanced search functions instead of depending on a few pre-defined listings, the 'on-the-fly' method will need to be built anyway.
So here's what I need to know:
1. Can I use PHP on FQ to write files derived from MySQL queries to my web-folders? Are there security issues associated with this (either mine or FQs) that should keep me awake at night?
2. Is there really a meaningful performance difference between hitting a static file and pulling a query? I expect that a lot has to do with file/set size, so I'll give you the basics: Maximum 300 rows in a single result set, with a maximum row length of 300 bytes (I have medians and averages as well, but there is also a trend that suggests I should be prepared to have most of the results max'd out!).
3. Is there anything I need to know that I don't know I need to know (if you know what I mean %) ) or anything else you need to know in order to provide sound advice?
Thanks for any help you folks can provide.
Ron