|WCGI Is WebAssembly + Old School CGI|
|Written by Nikos Vaggalis|
|Monday, 22 May 2023|
WCGI combines the newest innovations with the technology of the old school. To what end? CGI is dead. Long live WCGI!
CGI (Common Gateway Interface) was a way for web servers and server-side programs to interact simply by taking a request over STDIN and returning a response over STDOUT. The protocol, however was inefficient, because it required a new process to be respawned each time a page was served. As such it was superseded by technologies which were better, faster, more secure, with better integration with the web server.
One such was FastCGI which was introduced as a middle ground between the PHP Apache Module and the CGI application. It allowed scripts to be executed by an interpreter outside of the web server and included the security benefits of CGI without any of the inefficiencies of CGI. For an example in Java, see Servlets.
Now enter the brave new world of WebAssembly. In "Spin Brings WebAssembly To The Cloud" we found that:
And there it is - WAGI - WebAssembly Gateway Interface. The WAGI server, provides a web server that answers requests. On each request, it loads the appropriate WebAssembly module, translates the HTTP request to a CGI request, and then runs the module. All of the threading and state management is handled in the WAGI server, while a WAGI WebAssembly module just has to handle a single request.
The new kid on the block is now WCGI as in WebAssembly + CGI. WCGI represents a refined approach to server-side development, integrating the flexibility, security, and performance of WebAssembly. WCGI was found by Wasmer which when venturing into serverless solutions, faced a crucial question -should they create their own framework and risk locking developers into a walled garden, or should they adopt an open standard that allows them to utilize existing code?
It turns out that WebAssembly+CGI was the most sane attempt, since you:
But WAGI does sound a lot like WCGI, doesn't it ? In essense both are means of writing and executing HTTP response handlers as WebAssembly modules.
They are two very similar protocols, one founded by Wasmer and the other by Deis Labs. Which one will prevail only time can show. Nevertheless both WCGI and WAGI at the time are compatible.
In conclusion, IT although an incubator for innovative technologies, it has the tendency of going in circles reviving old technologies and bringing them back to life, for instance Microservices to Monolith, or SPA to SSR. This is another case where the simplicity of the 'old' technology is so insurmountable that is hard to resist.
There's already a Rust and PHP template for for creating a WCGI-compatible package that can be published to WAPM, as well as a WCGI WordPress Demo. Links below.
Summer SALE Kindle 9.99 Paperback $10 off!!
or email your comment to: email@example.com
|Last Updated ( Monday, 22 May 2023 )|