नए सर्वर के लिए वेब सर्वर कैसे सुनते हैं?

विषयसूची:

नए सर्वर के लिए वेब सर्वर कैसे सुनते हैं?
नए सर्वर के लिए वेब सर्वर कैसे सुनते हैं?

वीडियो: नए सर्वर के लिए वेब सर्वर कैसे सुनते हैं?

वीडियो: नए सर्वर के लिए वेब सर्वर कैसे सुनते हैं?
वीडियो: Extending Google Workspace with AppSheet’s no-code platform and Apps Script - YouTube 2024, अप्रैल
Anonim
वेब सर्वरों के बारे में सीखते समय और वे कैसे काम करते हैं, यदि आप लगातार अनुरोधों को सुन रहे हैं या यदि वे कार्रवाई में जाने का अनुरोध प्राप्त करते हैं तो वे उत्सुक हो सकते हैं। इस बात को ध्यान में रखते हुए, आज के सुपर यूज़र क्यू एंड ए पोस्ट में पाठक की जिज्ञासा को पूरा करने के जवाब हैं।
वेब सर्वरों के बारे में सीखते समय और वे कैसे काम करते हैं, यदि आप लगातार अनुरोधों को सुन रहे हैं या यदि वे कार्रवाई में जाने का अनुरोध प्राप्त करते हैं तो वे उत्सुक हो सकते हैं। इस बात को ध्यान में रखते हुए, आज के सुपर यूज़र क्यू एंड ए पोस्ट में पाठक की जिज्ञासा को पूरा करने के जवाब हैं।

आज का प्रश्न और उत्तर सत्र हमारे पास सुपरयूसर की सौजन्य है - स्टैक एक्सचेंज का एक उपविभाग, क्यू एंड ए वेब साइट्स का एक समुदाय संचालित समूह।

स्क्रीनशॉट xmodulo / लिनक्स स्क्रीनशॉट (फ़्लिकर) की सौजन्य।

प्रश्न

सुपर यूज़र रीडर उपयोगकर्ता 2202911 जानना चाहता है कि वेब सर्वर नए अनुरोधों के लिए कैसे सुनते हैं:

I am trying to understand the ‘deeper level’ details of how web servers work. I want to know if a server, say Apache, for instance, is continuously polling for new requests or if it works by some sort of interrupt system. If it is an interrupt, what is sparking the interrupt? Is it the network card driver?

वेब सर्वर नए अनुरोधों के लिए कैसे सुनता है?

उत्तर

सुपरयूसर योगदानकर्ता ग्रेग बोवेसर का जवाब हमारे लिए है:

The short answer is some sort of interrupt system. Essentially, they use blocking I/O, meaning they sleep (block) while waiting for new data.

  1. The server creates a listening socket and then blocks while waiting for new connections. During this time, the kernel puts the process into an interruptible sleep state and runs other processes. This is an important point; having the process poll continuously would waste CPU resources. The kernel is able to use the system resources more efficiently by blocking the process until there is work for it to do.
  2. When new data arrives on the network, the network card issues an interrupt.
  3. Seeing that there is an interrupt from the network card, the kernel, via the network card driver, reads the new data from the network card and stores it in memory. (This must be done quickly and is generally handled inside the interrupt handler.)
  4. The kernel processes the newly arrived data and associates it with a socket. A process that is blocking on that socket will be marked runnable, meaning that it is now eligible to run. It does not necessarily run immediately (the kernel may decide to run other processes still).
  5. At its leisure, the kernel will wake up the blocked web server process. (Since it is now runnable.)
  6. The web server process continues executing as if no time has passed. Its blocking system call returns and it processes any new data. Then go to step 1.

स्पष्टीकरण में जोड़ने के लिए कुछ है? टिप्पणियों में विचार व्यक्त करो। अन्य तकनीक-समझदार स्टैक एक्सचेंज उपयोगकर्ताओं से अधिक उत्तरों पढ़ना चाहते हैं? यहां पूर्ण चर्चा धागा देखें।

सिफारिश की: