I have a XML feed which contains 1000+ records of properties (rent, sale).
Currently I am calling this feed 16x on homepage, always returning only 3 properties for specific criteria like 3 new house, 3 new flats, etc, 5 recommended house, 5 recommended flats etc.
This scenario was working well for 7 months whilst there was 200+ properties and only 100-200 views a day. It is now getting to stage where I have 700+ visits a day and over 1000+ properties and downloading 16 feeds separately just to show homepage is getting slower and traffic is getting massively larger.
Therefore I would like to cache these streams, I would like only my 'robot' to directly download streams from source and all visitors to use my local copy to make things much quicker and decrease traffic load massively.
I dont have a problem downloading XML locally and locally call files to show data. But I would like to know how to solve possible issues like:
- not showing data to clients because robot is updating XML files and original file would be overwritten and empty whilst loading new data
- using XML file as local backup, means that if source server is offline homepage would be still working and loading
- making sure that I wont lock data for clients in such way that robot would be unable to update files
My first toughts would be to work with 2 xml files for every stream, one which would be shown to clients and one which would be downloaded. If download is correct then downloaded XML would be used as live data and other one deleted. Some kind of incremental marking with one file working as file holding name of actual data.
Is there any way how to cache these XML files so it would do something similar? Really the main issue is to have bulletproof solution so clients wont see error pages or empty results.
Thanks.