Subtle thoughts on website architecture

We are in our WIT-e, of course, amblers. Own ERP-system (wrote about it here - How can we do without 1C? ), Its own CRM-system, its own M2M for communication with distributors ("what other clever words and abbreviations do you know?"). And, of course, your approach to WWW, to remain within the framework of this 3-letter paradigm.

It all started with a love of Microsoft, and some of the early versions of the site back in the late 90s was made using ASP technology, and as a database under it lay a regular MS Access file. By the way, providers still offer hosting on the good old ASP, 18 years after its upgrade to ASP.NET - here you have legacy systems in all its glory.

In general, this is quite convenient - since the internal database is also written in MS Access, the procedure for preparing data for the site was very simple, no re-translations from one data format to another (MySQL for example). Access supports an extension of the SQL language of the form “IN <external database name>”, which can be added after any DML instructions: INSERT, UPDATE, DELETE (here's another 3-letter abbreviation).

As this link grew, of course, it started shamelessly slowing down (plus those that happen are unclear when the mdb-file locks with the database lock down the whole site tightly). Translation of the site to ASP.NET did not fundamentally solve the problem, and it was also necessary to switch to MS SQL Server as a base, but then the process went in a different direction. Let's look at the problem of improving website performance from a slightly different perspective.

(By the way, my 1Gb.ru provider writes that ASP.NET is on average faster than the standard LAMP bundle (Linux / Apache / MySQL / PHP), which has become a revelation for me. But who can I trust here as it is not the operator of the whole thing? )

Disclaimer - subsequent ideas represent, on the one hand, some theoretical construction elevated to absolute, which often means reduced to absurdity, on the other hand, concrete implementation, so it cannot be said that the author is in his fantasies and completely detached from reality.

Question 1. Why should there be a database under the site?

Well, really, you all admire the speed of In-Memory Databases, right? So why go far, get yourself one right under your website. And even more. At initial initialization, load all the data into arrays available at the site level as a whole (Application object in ASP.NET, Global Variables in PHP, hereinafter everywhere), and instead of writing queries to the database, just loop through these arrays. Anything is suitable for the initial data loading - the same MS Access database, but at least text CSV files! - the operation is performed infrequently and its execution time does not play any role.

There are questions, but we already have ready-made answers to them.

  1. , - , ? – ( , -), — ,
  2. ( ) . . – ( ) , ? , – / , – , . . Catalog ( -!) 2 – :



    MinIndex MaxIndex. , - ( ) – Parts ID Catalog, – .

Note that this idea can be continued further. In the same way that data is transferred from the database under the site to the data structure of the site itself, when generating a web page, the data it needs to be placed in its structure itself - that is, in JavaScript arrays. And there are no AJAXs, asynchrony, communication error handling, and more. And so it was done on our site on pages containing all kinds of configurators.

By the way, unlike database files, the arrays in the memory of the web server (and the web browser too, albeit with reservations) occupy a size approximately equal to their binary representation, while an empty database with a single table in it already draws on many hundreds of kilobytes.

Question 2. Why do I need to use scripts on a web server?

I bring a code fragment in several lines, deliberately simplified and in the craziest of programming languages ​​- VBA (except for 1C)

        Set IE = CreateObject("InternetExplorer.Application")

        IE.Navigate "wit.ru"
        While IE.ReadyState < READYSTATE_COMPLETE
        Wend

        Set str = IE.Document.DocumentElement
        HTML = str.innerhtml

The code does the following - runs the page through the once very popular browser of one well-known company, and saves the result of working out the server script as pure HTML. You guessed it, probably, what will be offered next? Quite right - it is quite possible to make a site as purely HTML in the old 90s.

(Again from 1GB.ru: “IIS very quickly and efficiently processes requests for static files”)

At the same time, you may have to worry about transcoding addresses like
wit.ru/card.aspx?id=23&prodid=1022985
into static web addresses webpages is also a well-known web server tune-up technology, originally invented for fooling search engines and web optimization.

Here it is necessary, probably, to formulate the basic principle from which all the others are derived. The more time and resources we spend on preparing data for the website, the easier it will be for him to display it and the faster he will be able to do it. In this case, our back-end can work in continuous mode, spitting out ready data on the site with the frequency we need. And this approach will work in all cases, except, of course, exchange summaries or windows of some Amazon or Alibaba, where the data changes every second.

Conclusion


I am aware that the problems in the article are too pointed and a non-standard solution is proposed. I’ll venture to suggest (this is not my topic at all) that such an approach could work for any embedded systems, where otherwise, on a weak computing device, you have to place a mini database engine and a script handler instead of the simplest web server (at the cost of more memory consumption - operational and constant).

All Articles