当前位置:网站首页>Briefly describe the difference between CGI and fastcgi

Briefly describe the difference between CGI and fastcgi

2022-06-12 13:49:00 wwzroom

CGI:Common Gateway Interface Public gateway interface , It's the external extension application and Web A standard interface for server interaction , Mainly web When the server is used to process dynamic resource requests , Call the interface of the network server .

Request flow :
Client – (http agreement ) --> httpd – (cgi agreement ) --> application server (program file) – (mysql agreement ) --> mysql
web According to the content of this request, the server will , And then fork A new process to run external C Procedure or bash,perl Script etc. , This process will return the processed data to web The server , Last web The server content is sent to the user , Just now, fork And the process of getting out . If the next user requests to change the dynamic script , that web The server again fork A new process , Go round and round .

fastcgi:FastCGI(Fast Common Gateway Interface) The full name is “ Fast universal Gateway Interface ”, Is a common gateway interface (CGI) Enhanced version of , from CGI From development and improvement , Mainly used to improve CGI Program performance , Be similar to CGI,FastCGI It is also a way for interactive programs to interact with Web Protocol of server communication .
Request flow :
Client – (http agreement ) --> httpd – (fastcgi agreement ) --> fastcgi The server – (mysql agreement ) --> mysql

fastcgi The way is ,web When the server receives a request , Not again fork A process ( Because the process is web It's on when the server starts , And won't quit ),web The server passes the content directly to the process ( Interprocess communication , but fastcgi In other ways ,tcp Means of communication ), The process processes the request , Return the result to web The server , Finally, I wait for the next request , Instead of quitting

CGI and fastcgi Compare
CGI: Part-time job , A one-time bridge breaking service
FASTCGI: full-time , Full cycle continuous service

 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[wwzroom]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121340453316.html