• net

    (@krstarica)


    Currently we have two performance bottlenecks:
    1) PHP
    2) Database queries

    We can get rid of database queries by using file system.

    PHP could also be avoided if web server serves JSON files directly using mod_rewrite or similar.

    WP Super Cache plugin is using both concepts for HTML requests, so we could do it for REST API requests.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @krstarica

    Thank you for using our plugin and sorry for the late reply.

    You bring up an interesting point and certainly something we could consider to implement in the future. However don’t expect it to be included very soon, it is a big change and unfortunately we will not have enough time soon.

    Thread Starter net

    (@krstarica)

    Thanks for your reply.

    Note that the speed difference is more than 4 times.

    WP REST Cache returns data in 170 ms and WP Super Cache returns data in 40 ms.

    This is good point, JSON based endpoints are great. I re-write WP api to my own api used custom endpoints (only GET). It brings hell lot more speed to the page. But then I made it to save data to JSON and it is just crazy fast. Examples: svw.no – Nuxt, Polylang, over 3k posts and pages, then maritimpolitikk.no – NUXT, multisite, polylang, hunderts of posts, each sub site is a /year actually, lvk.no (one of many in the network) NUXT, multisite, where each site have own domain (this was tricky), each page in the netowkr contain couple of thousands posts nad pages, LVK alone is over 8k, user based/ access levels etc. And due to move to JSON based api it is really crazy fast for that amount of content. There could be more optimization in code, I know, but the time. (I have couple of more pages, also just PHP + VUE, that are great in term of speed)

    My point is, JSON based endpoints are really great, and hooks that allow e.g filter out some of content based on user levels/capabilities are handy. At this point I’m not specialist in PHP nor MYSQL so my queries and code there is not super great, and could be improved in many ways. So if there is some one who already made such great plugin, and maybe could improve it event more would be soooo great!
    Just note. I’m using JSON files, but those are readed by custom PHP file that use base WP elements if needed (I’m loading WP files on demand if I need some functions like resolve user) then this PHP file does all filtering, etc based on those JSON files.

    REALLY LOOKING FOR IT! <3

    • This reply was modified 2 years, 11 months ago by Isu.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Serving static JSON files’ is closed to new replies.