Wednesday, July 27, 2022

Full Stack of web services & How you choose your components !!

Full Stack of Web Services and How you choose your components !!

As full stack consist of two major components , namely:

  • Front end (client) and

  • Back end (Server).

The front or the client side is mainly user-interface of the web application that the user interacts with the system. Usually built with language tools such as HTML, CSS, JavaScript, Libraries etc. However there are exceptions.

Then again, the back end of the stack handles the data provided by the client and processes, and makes the connection between repositories+engines and the clients or the front end interface. Basically the web server/cloud that consists of servlets and repositories, that will use different programming languages like PHP, Python, Java, Perl, CGI, C,C++, Micro Languages etc, along with servers like :

  • Apache
    Apache The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation that was established in 1999, the ASF is a US 501(c)(3) charitable organization, funded by individual donations and corporate sponsors. Our all-volunteer board oversees more than 350 leading Open Source projects, including Apache HTTP Server -- the world´s most popular Web server software. { source wikipedia }
  • NginX
    NginX Nginx (pronounced "engine X"), stylized as NGINX, nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license. A large fraction of web servers use NGINX often as a load balancer. { source wikipedia }
  • IIS
    IIS Internet Information Services (IIS, formerly Internet Information Server) is an extensible web server software created by Microsoft for use with the Windows NT family.[2] IIS supports HTTP, HTTP/2, HTTPS, FTP, FTPS, SMTP and NNTP. It has been an integral part of the Windows NT family since Windows NT 4.0, though it may be absent from some editions (e.g. Windows XP Home edition), and is not active by default. { source wikipedia }
  • OpenResty
    OpenResty OpenResty is a web platform based on nginx which can run Lua scripts using its LuaJIT engine. The software was created by Yichun Zhang. It was originally sponsored by Taobao.com before 2011 and was mainly supported by Cloudflare from 2012 to 2016. Since 2017, it has been mainly supported by OpenResty Software Foundation and OpenResty Inc.
    OpenResty is designed to build scalable web applications, web services, and dynamic web gateways. The OpenResty architecture is based on several nginx modules which have been extended in order to expand nginx into a web app server to handle large number of requests. The concept of the OpenResty solution aims to run server-side web app completely in the nginx server, leveraging nginx event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis. { source wikipedia }
  • Cloudflare Server
    Cloudflare Server Cloudflare is most well known as a Content Delivery Network (CDN). Today it has grown past that and offers a range of services mostly covering networking and security.
    Their stated mission: To help build a better Internet.
    To understand that, consider your experiences with the Internet so far. I’m certain there have been instances where you encountered slow or unresponsive web pages. There are many reasons why this is so, but the end result is the same – your browsing experience is affected.
    Even worse, you may not have been able to access the content which you needed. That’s one of the main reasons why Cloudflare and other companies like it exist.
    Cloudflare owns and operates a massive network of servers. It uses these to help speed up websites as well as protect them from malicious attacks like DDoS. Ultimately, websites that use services like Cloudflare are safer and offer their users a better browsing experience. { source Article by: Timothy Shim }
    etc.
Makes up the back-end/Web Server

However when it comes to selecting the best combination we have to look at what each programming language is capable of such as PHP, Python, Perl and Ruby will take care of almost all kinds of database handling and data processing however if your requirement is beyond database manipulation; for an example if it is a real-time data manipulation like an IBMS where you have control your building services ( a gate control ), then you have to look at your hardware and server capabilities where you will have to write some low-level programs like C/C++ or micro C.

Data Flow and Definitions (compendium of the data & the flow)

Important fact is that, before trying to find out which is the best stack you are going to use, you have to have a compendium of the data-flow and its definitions. if you have real-time data then your stack will extend up to hardware level. Hence you have to come up with the hardware stack to bridge the communication between your web server and

SCADA Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery.
data bus (real time data bus that runs MODbus, DNP3, MQTT etc ). Thus, web server that will allow modular plugins or such control is essential.



Data Communication

Then you can work from the bottom where your data starts. if it is a data repository then you can start from required procedure calls or SCADA communication that will provide an API to the application layer communicate with the data objects. at this level using an abstract notation of your data is very use-full since it will give a easy conceptualization and designing of upper layers of the stack.

Client View/ User Interface (UI)

Then you have to look at the requirements of your User Interface, That could be a web browser or mobile app or any kind of IOT. But in most situations all these interfaces has the ability to handle the client-server communication via an API that supports XML or Json. thus we could assume that platform that runs the UI could be capable of handling

REST API A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.
Hence we do not have worry much about clients side.

Web Server

When it comes to the web server, you have to make sure both requirements of the client side and also the data objects are met. In most cases these requirements can be handled but some web servers like IIS fails miserably. But in most cases Unix based web servers has the ruggedness make sure it functions as required. Then again two Unix based servers comes on top, namely

  • Apache
    Apache The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation that was established in 1999, the ASF is a US 501(c)(3) charitable organization, funded by individual donations and corporate sponsors. Our all-volunteer board oversees more than 350 leading Open Source projects, including Apache HTTP Server -- the world´s most popular Web server software. { source wikipedia }
  • NginX
    NginX Nginx (pronounced "engine X"), stylized as NGINX, nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license. A large fraction of web servers use NGINX often as a load balancer. { source wikipedia }
Unfortunately Nginx does not have the capability to handles all the requirements when you compare Apache vs Nginx Theretofore Apache will be my pick that will support any type of stack you want to build.

Application

Application development mostly revolves around the language you pick and any language like PHP, Python, Java, Perl can be used to develop web service, or create Common Gateway Interface (CGI) scripts to handle lower levels functions like SCADA interfaces. Most important part is that choosing the correct language that suits your requirement. But in some situations you have pick multiple languages to achieve this. for an example achieving tasks that can be done with PHP, Python, Java or Perl could be done with C/C++ as well but it will be impractical. Therefore it is important that you select the correct language to achieve each task, where one might end up with multiple languages in one server.

one important fact is that it is always better to develop your application API spec that is formulated and confirms to the

REST API A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.
that confirms to constraints of REST architectural style and allows for interaction with RESTful web services

By employing such methodology you can make sure that application stack and UI stack can be developed interdependently where mobile app developers, Web UI Developers and all other IOT developers has the freedom to continue their development without having to depend on each other.

Components of the Stack

In most cases web developers tend to create single application component that create many restrictions so it is important to modularize each stack component that allows additional stack components at later stage.

  • Data Layer
  • Application Layer
  • UI
  • App
  • IOT
As mentioned before Data Layer, Application Layer, and UI Layer components are developed in one stack layer that could functions as typical web service but when it come to additional components, you will go back and develop separate Data and Application layer components to handle other interfaces.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Back to Pragmatic Engineering