2012-12-20 11 views
6

मैंने अपने सर्वर में एपीसी PHP स्थापित किया है। PHPinfo इसे दिखा रहा है। लेकिन अभी एक सवाल है क्योंकि मैं थोड़ा उलझन में हूं ...PHP में सक्रिय एपीसी

क्या सर्वर पर आने वाले नए PHP अनुरोध स्वचालित रूप से एपीसी का उपयोग शुरू कर देंगे या क्या एपीसी के उपयोग के लिए PHP कोडों को भी संशोधित करने की आवश्यकता है? क्या आप कुछ सुराग प्रदान कर सकते हैं।

धन्यवाद

+0

मैं कुछ मामूली गति बढ़ जाती है सिर्फ देखा है सरल पृष्ठ अनुरोधों और हस्तांतरण राशि/सेकंड के लिए मॉड्यूल स्थापित करके। लेकिन आप निश्चित रूप से तब तक नहीं जान पाएंगे जब तक कि आप बिना किसी परीक्षण के कुछ परीक्षण करते हैं। अपाचे बेंच उपयोगिता देखें http://httpd.apache.org/docs/2.0/programs/ab.html आप इसके साथ चीजों को मैन्युअल रूप से कैश भी कर सकते हैं ... http://php.net/manual/en/ book.apc.php – antman

उत्तर

0

यह प्रयोग किया जाएगा। जब तक apc.enabled का डिफ़ॉल्ट मान गलत नहीं है, तो इसे phpinfo में देखें।

यदि सक्षम सेटिंग्स ठीक है तो पहला एपीसी उपयोग ओपोड होगा। अपनी PHP स्क्रिप्ट के "संकलित" संस्करण को संग्रहीत करना। अब इस व्यवहार को एपीसी की कई सेटिंग्स चालू करके बहुत उत्साहित किया जा सकता है (जैसे प्रत्येक फ़ाइल एक्सेस पर स्रोत कोड संशोधनों की जांच करने से बचें)।

एपीसी में दूसरी बड़ी कार्यक्षमता भी है जो इसे आपके आवेदन के लिए एक पर्सिटेंस/कैश स्टोरेज के रूप में उपयोग कर रही है। लेकिन इस अभ्यास के लिए चीजों को आपके आवेदन में विशिष्ट अनुप्रयोग निर्देशों की आवश्यकता होती है जैसे कि आप डेटाबेस का उपयोग कर रहे थे। these functions देखें।

वास्तव में एपीसी अनुकूलन सक्रिय करने के लिए आपको सभी एपीसी सेटिंग्स को देखना चाहिए। apc.shm_size और apc.shm_segments एपीसी मेमोरी के आकार के लिए सेटिंग्स की जांच करने के लिए सबसे उपयोगी हैं और सभी virtulahosts के लिए साझा किए जाते हैं। लेकिन सिद्धांतों के मूलभूत सेटिंग्स के बाद यहां कुछ चीजें हैं जिन्हें आपको वर्चुअलहोस्ट/एप्लिकेशन (जहां आप php_value निर्देशों का उपयोग करेंगे) - या वैश्विक php.ini में - यह एक उत्पादन कॉन्फ़िगरेशन का एक निकास है:

ध्यान दें कि आप प्रत्येक सक्रिय स्थापित करने और read the documentation को समझना चाहिए, वरना आप विकास में घंटे खो में खत्म हो जाएगा परिवर्तन के रूप में अपने स्रोत कोड अभ्यस्त php के द्वारा पढ़ा जा

# Activate apc 
apc.enabled =1 
# Optimisation of include/require_once calls 
apc.include_once_override =1 
# transform paths in absolute ones (no effect if apc.stat is not 0), 
# files from stream wrappers (extended includes) 
# won't be cached if this is activated as they cannot be used with php's realpath() 
apc.canonicalize =1 
# In production set it to 0, then file changes won't be observed before 
# apache is restarted, 
# significant boost, else file time is stated at each access (needed at 1 in dev) 
apc.stat =0 
# avoid problems with rsync or svn not modifying mtime but only ctime 
# so if you're in production set this to 0, like for the previous one 
apc.stat_ctime =0 

# deprecated option: apc.optimization not available anymore 
# apc.optimization =0 

# inform apc on number of files of the application 
apc.num_files_hint =2000 

# inform apc on the number of cache variables 
apc.user_entries_hint =100 

# cache lifetime managmenent ---------------- 
# time (s) we can stay on the cache even when the cache is full -- Cache full count -- 
# that means Garbage Collector is never inactivating theses datas before this time is over 
# >0 -> old data could stay in the cache while new data want's to come, if no data is deprecated 
# 7200 -> entries older than 2 hours will be thrown to make some place 
# 0 -> emptying full cache when full 
apc.ttl =0 
apc.user_ttl =0 
# this one is the same but you should note this this prevent Garbage collecting 
# after each source change. 
apc.gc_ttl =0 

# What to cache ? ---------------------------- 
# could be used to prevent some caching on specific files 
# but it's better to cache often used files, isn't it? at least in production 
#apc.filters ="-config.php-.ini" 
# default to 1M, files bigger than that won't be cached 
apc.max_file_size ="5M" 

# various things ------------------------------- 
# only one process caching a same file (beter than apc.slam_defense) 
php_fla apc.write_lock =1 
# prevents caching half written files (by cp for example) by waiting x seconds 
# for new files caching. set it to 0 if using only rsync or mv 
apc.file_update_protection =2 
# newest versions of APC only 
# adding a lazy loading capabilities, so you can parse a lot of files 
# and only used things are cached 
#apc.lazy_functions =1 
#apc.lazy_classes =1 
2

PHP स्वचालित रूप से इसका उपयोग करेगा। कैशिंग त्वरक का उपयोग करने के लिए आपको अपना कोड बिल्कुल बदलना नहीं है।

1

एपीसी स्वचालित रूप से चल रहा है। मॉड्यूल आपके कोड को चलाता है और इसे बाइटकोड में परिवर्तित करता है। जब आप अपनी स्क्रिप्ट को फिर से कॉल करते हैं तो आपका वेबसर्वर बाइटकोड निष्पादित करने के बजाय स्क्रिप्ट को फिर से नहीं चलाता है।

यदि आपके पास बहुत अधिक ट्रैफ़िक है तो यह बहुत सारे प्रदर्शन को बचाता है।

दूसरा फ़ंक्शन यह है कि यदि आप चाहें तो एपीसी से साझा मेमोरी में मूल्यों को सहेज सकते हैं। इसके लिए आपको दस्तावेज़ीकरण पढ़ना चाहिए। यदि एपीसी मौजूद है

http://php.net/manual/de/book.apc.php

संबंधित मुद्दे