• Hey!
    I am possibly trying to do something very special and I am not yet sure I am on the right track, so feel free to overthrow everything.

    I will be building a website for mainly showing events, enable filtering those and display specific ones by the categories and event type you chose. So far that can be done quite well with WordPress and Custom Post Types. The special basis for this project is, that WordPress will not save the data.

    I am working with a company who is specialised in providing databases for storing content with XML markup to keep the data output neutral and things like those. As their strength is not in frontend design and functionality WordPress is the tool of choice for doing that part of the work.

    They will provide a JSON API/an interface to retrieve all possible and needed data from their database but I am not sure whether I should store that data in the WordPress database or not.

    My main concerns are things like synching the WP database with theirs (you could handle that, I am sure), copying uploaded files from their servers to mine etc. pp.

    So I thought I would just query their database, retrieve all information, “build” the page I want to output and cache the whole HTML output on my server. In that way I would just have to check their database for the latest changes and rebuild those pages. But I really wonder how to do the last part without generating “real pages” in WordPress and caching them afterwards.

    This is not yet planned totally and there will be talks with the database guys soon, but I′d like to make my mind up on those things before and I stumble about this specific way to do it. Maybe it′s not the best way after all for performance reasons and whatever, but in my mind I′m like “let them handle the data, you care about the looks”.

    Any ideas on this?

    Thanks!

    Kind regards
    Florian

Viewing 2 replies - 1 through 2 (of 2 total)
  • Yes, that is a reasonable way to build a dynamic website, the latency of the HTTP requests to retrieve the data from the external server may be hard to maintain but this is not the first time someone tries to do that.

    Regarding your concern about how to “retrieve/build/cache” the data, there are multiple ways to accomplish that using multiple techniques. I will give you my opinion according to my experience in projects like that. The key here will be the cache mechanism, it will be the interface that will determine if to retrieve the data from the external service or to render the page from the local data.

    Varnish [1] is always my preferred software for these things, it has multiple configuration options, has scalability by default, is designed to be distributed, and requires virtually zero maintenance. It will pass the initial requests to the application to retrieve the remote data, you will build the page as you would do normally, then proceed to pass that data to Varnish, and next time the same data is requested it will not pass to the application but instead the cache system will render the page(s) from the data available in the local server.

    Alternatively and considering that you do not want to generate “real pages” in WordPress to re-build the cache, you could simply store the JSON data for a certain period of time. I do not know how much information will be stored in the external service but in rare cases I have seen that is better to cache only specific parts of the interface and keep others dynamic, which is not a good idea but I have seen some examples of when this is not as bad as it sounds.

    I hope you can structure your project the way you want, good luck.

    [1] https://www.varnish-cache.org/

    Thread Starter flomei

    (@flomei)

    Thanks for your reply. I will have a look at Varnish, its possibilites and ways to integrate and fit it to my needs.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Retrieve content via JSON, use WP as a hull for displaying it’ is closed to new replies.