Acting for developing Green Web Applications
You are aware that digital technology contributes day after day to climate change.
As a developer, we have a responsibility to limit the use of machine resources (CPU, disks and network traffic) as much as possible.
It is for this reason that I strive as best as I can to optimize ZnetDK 4 Mobile in its design and its improvements so that the applications developed are as sober as possible in their consumption of machine resources.
I present to you below the choices made and the strategies applied to achieve them.
Saved machine resources: Network traffic, CPU, Storage
See below the web resources downloaded by the web browser when the ZnetDK 4 Mobile Starter App is displayed for the first time (file cache is empty).
RESOURCE | FILENAME | TYPE | SIZE |
---|---|---|---|
ZnetDK 4 Mobile JS API | mobile-min.js | JavaScript | 93 kB |
jQuery | jquery-3.6.0.min.js | JavaScript | 90 kB |
FontAwesome | fontawesome-webfont.woff2 | Font | 77 kB |
FontAwesome | font-awesome.min.css | CSS | 31 kB |
W3.CSS | w3.css | CSS | 24 kB |
ZnetDK 4 Mobile Main page | index.php | Html | 16 kB |
ZnetDK 4 Mobile Favicon | favicon.ico | Icon | 15 kB |
EXO Font | exo-v7-latin-regular.woff2 | Font | 11 kB |
ZnetDK 4 Mobile logo | android-chrome-192x192.png | Picture | 10 kB |
ZnetDK 4 Mobile logo | logoznetdk.png | Picture | 6 kB |
ZnetDK 4 Mobile Stylesheet | mobile-min.css | CSS | 4 kB |
W3.CSS theme | w3-theme-blue.css | CSS | 2 kB |
EXO Font | exo-v7-latin-regular.css | CSS | 1 kB |
TOTAL | 380 kB |
Thanks to PWA technology, the service worker installed when the application is first loaded has stored in the browser's cache memory the main web resources required to display and operate the application.
When the application is loaded the following times in the web browser, the web resources stored in the cache memory are no longer downloaded, which represents a saving on network traffic of approximately 364 kB.
Only 3 MB of space disk is needed to install ZnetDK 4 Mobile on your web hosting.
The ZnetDK 4 Mobile web applications are designed as Single Page Application (SPA) which means that only the layout of the HTML page is loaded when the application is accessed from the web browser.
When an application view and its data needs to be displayed, the HTML code of the view and the data in JSON format are loaded on demand in AJAX and added to the main page's DOM (i.e. Document Object Model), without the need to completely reload a new HTML page.
After a view has been loaded for the first time in the DOM, during subsequent displays of the view, its HTML code is not reloaded, only its data is reloaded in JSON format.
Saved machine resources: Network traffic
When suggestions are fetched from the web server and displayed by the Autocomplete widget, they are stored in the browser's cache in case the same suggestions might be offered the next time a keyword is typed into the same autocomplete widget.
Network traffic can be optimized by tweaking the autocomplete properties.
To limit the number of SQL query executions, the information of the logged in user is stored in session and accessible via the ZnetDK PHP class \UserSession
.
ZnetDK 4 Mobile is designed to reduce the number of SQL queries executed by the SQL server as much as possible.
To trace and reduce the number of queries executed by features added to your web application, the CFG_SQL_TRACE_ENABLED
parameter can be enabled.
It is recommended to run server-side application processing with the most recent version of PHP.
Since version 7.0 of PHP, the execution of PHP scripts has been particularly optimized, which has the effect of drastically reducing CPU usage.
The latest version of ZnetDK 4 Mobile is compatible with PHP version 8.1 which should be preferred as much as possible.