1

I have to load some XML data (generated from a database, using PHP) into a flash slideshow. The database data will change only when someone edit the website at it's backend.

In terms of loading speed and performance, which is best:

1) Generate the XML data dynamically from the database, each time the page is loaded;

2) Generate a .XML file whenever the database is updated, which will be read by the flash file.

Rittmeyer
  • 59
  • 8

3 Answers3

2

The fastest is likely

3) use Memcached

Otherwise it is likely 2 because connecting to a database is usually a bottleneck and often slower than file I/O. But then again, you could simply benchmark it to see which works best for you. That's much better than assuming.

Also, have a look at this related question:

Community
  • 1
  • 1
Gordon
  • 312,688
  • 75
  • 539
  • 559
1

@JapanPro He wouldn't need to write to the XML file when it was requested, just when someone saved something to the database. This would mean a much better load speed compared to pulling data from a database everytime.

Of course it depends how much data we're talking and whether it's worth writing to a file first. As @Gordon said, run some tests to see which works better for you

Alex
  • 7,320
  • 1
  • 18
  • 31
0

I think got for 1) Generate the XML data dynamically from the database, each time the page is loaded; is a good choice as its its normal as html. coz i think writing file always need more resource.

it depend on how your code is , if your code is processing alot of data every time, then writing file make sense

Pramendra Gupta
  • 14,667
  • 4
  • 33
  • 34