System Architecture =================== As previously mentioned, Acanban implements an :term:`ASGI ` application. The general architecture is illustrated in :numref:`asgi`. .. uml:: :caption: Acanban's role in the Asynchronous Server Gateway Interface :name: asgi left to right direction cloud Clients rectangle Hypercorn << ASGI Server >> rectangle Quart << ASGI Framework >> rectangle Acanban << ASGI Application >> Clients <--> Hypercorn : HTTP Hypercorn <--> Acanban Acanban --|> Quart All the data and business logic handling is done on the server side in order to reduce workload for the clients, and thus the details involving the clients are not discussed in this section. :term:`Requests ` to and :term:`responses ` from the ASGI application are transfered through the ASGI server [#server]_ Hypercorn. Typically, these messages are encrypted via TLS/SSL [#https]_. Persistency layers are provided by separate servers, which in our case are deployed on the same machine as the ASGI server and application. This has the following benefits: * The network latency is significantly lower within a machine. * We are spared from concerning with various security measures that would have been necessary were these servers are exposed to the Internet. * It is more economic to maintain fewer physical (or virtual) machines. While files uploaded by the users and generated by the system are stored in :term:`IPFS `, other data are managed by RethinkDB_. With these components, our test server, which is registered under the domain of acanban.ga_, has the top-level view described in :numref:`ga`. .. uml:: :caption: Deployment architecture :name: ga left to right direction cloud "Web Browser" as Browser << Client >> node "acanban.ga" as Server << Server >> { database "RethinkDB" as db component Acanban component Hypercorn collections IPFS } Browser --- Hypercorn: HTTPS Hypercorn -- Acanban IPFS - Acanban Acanban - db As both IPFS and RethinkDB are designed to be distributed and the HTTP is distributed by nature, it is straightforward to scale the system. A load balancer such as nginx_ can be added to distribute the requests to multiple Acanban instances as is shown in :numref:`arch-alt`. IPFS and RethinkDB can also be run as :term:`clusters `. .. uml:: arch-alt.puml :caption: Alternative architecture with load balancer :name: arch-alt However, we do not implement this architecture within the scope of this project, due to following reasons: - We do not have several servers to implement. - For intended use, the expected requests can go up to as many as 1000. Load balancing for such few requests is overhead. .. [#server] Not to be confused with the physical machine that *serves* over HTTP that may run the ASGI application and other software. .. [#https] HTTP over TLS or SSL is often known as HTTPS. .. _IPFS: https://ipfs.io .. _RethinkDB: https://rethinkdb.com .. _acanban.ga: https://acanban.ga .. _nginx: https://nginx.org