TS and NTS selection for PHP

Source: Internet
Author: User
Tags fpm

How much do you know about TS and nts in PHP?

1. Introduction

TS (thread-safety) is thread-safe, multithreading access, the use of the lock mechanism, when a thread access to a class of data, to protect, other

Threads cannot be accessed until the thread is read, and other threads are not available. No data inconsistencies or data contamination PHP with ISAPI

This version is selected when PHP is loaded as an ISAPI.

NTS (None-thread safe) is not thread-safe, that is, does not provide data access protection, there is a possibility that multiple threads have changed data resulting in dirty data php to run in fast CGI when the choice of this version, with better performance;

ISAPI (Internet server Application Programming Interface), which is typically loaded by an HTTP server and run as a server module, is proposed by Microsoft and can only be run on the win platform. For example, the apache,iis[in win is said to work more stably with fast CGI, while PHP on Linux runs in Apache modules or PHP-FPM.

CGI (Common Gateway Interface): A tool used by HTTP servers to "talk" to programs on your or other machines, and, frankly, CIG is a background language that can communicate with servers. PHP is running as a standalone program at this time. The feature is memory consumption.

Fast CGI. is a resident (long-live) type of CGI, it can always execute, as long as the activation, it will not take time to fork every time. This approach is a language-independent, scalable, CGI-open extension, The main behavior is to keep the CGI interpreter process in memory and thus achieve higher performance.

The difference between CGI and fast CGI to find the Niang.

2. Select

Usually win under the PHP and Apache combination, in the way of ISAPI, while Linux can be apche+php,php often as the Apache module, while nginx+php, Phpfast CGI way, that is, PHP-FPM way to run.

It is said that php-fpm this way to release the Web server, so that it only processing requests and concurrency, and PHP processing PHP-FPM completed, so nginx+php is now very popular, has not been measured.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.