9

I am trying to develop a simple system for sharing data across several websites. Most of them are developed in PHP while some are developed in Wordpress/Drupal. Redundant information is spread across several websites and this has caused a problem where we have to update the information across several websites separately.

I am trying to provide a solution where even static pages can get shared data. Here is my proposed architecture:

enter image description here

I am doing this for an academic institution. The data varies from simple fee structures to academic policies. For example consider academic costs.

Academic costs -> ug, graduate, pharmacy... each of the departments will have a fees structure categorized by off campus, on campus, commuter.

"Undergraduate": {
    "metaid": "0770",
    "Offcampus": {
      "FeesItems": {
        "comprehensive": {
          "label": "Comprehensive Fees",
          "value": "2,141"
      }
    }
  }
}

For front end using mustache, they just have to include the js and use something like below to get values,

<td>{{Undergraduate.Offcampus.FeesItems.comprehensive.label}} </td>
<td>{{Undergraduate.Offcampus.FeesItems.comprehensive.value}}</td>

My questions:

  • Is this design scalable?

  • How to give the data owners the ability to edit the data?

  • How to store the data in SQL?

2
  • By _"store the data in SQL" you mean the Microsoft SQL-Server RDBMS or any RDBMS? Commented Sep 3, 2016 at 23:16
  • Ajax Ajax Ajax Ajax
    – Mawg
    Commented Nov 3, 2016 at 16:55

4 Answers 4

1

Rather than attempting to answer the entire question, let me offer a concrete way to share data: just use any mechanism (jQuery, ajax) available in your implementation language that lets you call your webserver. Use a GET call to get constant data with automatic caching. Use a POST/PUT calls to get/set variable data. You can use other request methods, too, such as DELETE to delete the data storage. See Wikipedia: Request Methods For lots more data calls to build your shared data API. The page you call need not have any HTML on it; it can be a kind of data server which you write in any server-side language available.

0

Is this design scalable?

All designs are potentially scalable. An old (and outdated) rule is to add more hardware resources, and that's it.

Unfortunately, this rule does not work very well in the real world (the one where we pay for the resources that we make available to run the software, even if in the clouds).

In this case, the design of the software is absolutely scalable but maybe the question is: is this sustainable?

How to prevent stress

In the context of a data provider (public or through authentication), it is perhaps more prudent to include a cache system. To avoid a situation of high load on the database, it would be appropriate to add a publisher in your design.

I'm assuming that your "JSON Builder", is a component that interprets the request of the customer, reads data from the database, and finally sends the response.

If this is so, it is easy to understand that when you need to scale the system, the first to ask for resources, will be the database.

Distribute

Adding a cache system, probably the new resources will be allocated to publishers. A publisher can be a system of disconnected data, which receives (or fetches) information on the status of the data it holds.

At this point, it is easy to consider a publisher as a "low cost host" separate from the system, distributed (perhaps even through CDN), which uses a mechanism for continuous update its data (but at low cost for the database), to provide fresh data to the client.

Mechanism: Maybe a simple hash system, or an even simpler "last modified date"

How to give the data owners the ability to edit the data?

The question seems to have a simple answer. They will need an interface.

How to store the data in sql?

The comments are right, maybe it's offtopic

0

Q. How to make data available to multiple websites? A. A web service of your choosing. You can communicate with it using either responsive or non responsive website techniques. Non responsive means you typically use a non ajax (javascript asynchronious post) based system where the whole webpage is refreshed with each call of your web-service via a form post or you can use AJAX (client side Javascript, Jquery or a framework) to communicate with the webservice asynchronously to get data or update it.

Q. How to make data editable? A. Build your own web-pages with forms to edit the data.

Q. How to store the data in SQL? A. Secure (or un-secure if data is not sensitive or subject to data protection privacy laws) form posts to your web-service which get turned into SQL insert, update statements within the workings of your web-service.

You always get something "off the shelf" for the web-service, there are various frameworks etc. if you are not much of a programmer.

0
-2

Is this design scalable?

No, unless you host on a cloud MySQL database. JSON builder can be, depends how you code it and the web interface.

How to give the data owners the ability to edit the data?

Just make a PHP CRUD app with some framework, eg CakePHP etc.

How to store the data in sql?

Use the CRUD app to have a JSON to/from SQL converter. Loads of online PHP examples. JSON to PHP Array/MySQL and vice versa.

2
  • are these statements merely your opinions or you can back it up somehow?
    – gnat
    Commented Jan 15, 2014 at 12:55
  • Yes and yes. He can google the rest.
    – user127379
    Commented Jan 15, 2014 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.