Warning: fopen(/homepages/30/d192847469/htdocs/evilprofessor.co.uk/public_html/wp-content/gt-cache/hi/_hi_page_2) [function.fopen]: failed to open stream: Disk quota exceeded in /homepages/30/d192847469/htdocs/evilprofessor.co.uk/public_html/wp-content/plugins/global-translator/translator.php on line 1183

Warning: flock() expects parameter 1 to be resource, boolean given in /homepages/30/d192847469/htdocs/evilprofessor.co.uk/public_html/wp-content/plugins/global-translator/translator.php on line 1184

Warning: fwrite(): supplied argument is not a valid stream resource in /homepages/30/d192847469/htdocs/evilprofessor.co.uk/public_html/wp-content/plugins/global-translator/translator.php on line 1188

Warning: fclose(): supplied argument is not a valid stream resource in /homepages/30/d192847469/htdocs/evilprofessor.co.uk/public_html/wp-content/plugins/global-translator/translator.php on line 1190
Evilprofessor.co.uk

गतिशील क्रम में Zend_Navigation कंटेनर के लिए पृष्ठों को जोड़ने

द्वारा , गुरुवार 7th जनवरी 2010 10:50 बजे

Sitemap.xml के लिए कस्टम नियंत्रक / कार्रवाई का अनुरोध Zend_Navigation, के बारे में मेरे पिछले पोस्ट पर एक निरंतरता में , इस पोस्ट के क्रम / स्क्रिप्ट निष्पादन में dymnamically Zend_Navigation कंटेनर के लिए पृष्ठों को जोड़ने के बारे में है.

यह सब अच्छी तरह से और एक अच्छी पहल या में अपने पृष्ठों को निर्दिष्ट xml फ़ाइल है, लेकिन कुछ बिंदु पर आप अपनी साइट में पृष्ठों है कि आप एक मेनू, साइटमैप, या अपने ब्रेडक्रम्ब निशान में शामिल किया के हिस्से के रूप में चाहते हैं बदल गया है जा रहे हैं. इसलिए हम क्या करने की जरूरत है क्रम में हमारे Zend_Navigation कंटेनर के लिए पृष्ठों को जोड़ने. इस के लिए उदाहरण जोड़ने समाचार आइटम, ब्लॉग पोस्ट, या पृष्ठ टिप्पणी, आदि में होगा

जारी रखें पढ़ने 'गतिशील क्रम में Zend_Navigation कंटेनर के लिए पृष्ठों को जोड़ने के' »

मार्ग sitemap.xml के लिए कस्टम नियंत्रक / कार्रवाई करने के लिए अनुरोध

द्वारा , बुधवार 6th जनवरी 2010 12:13 हूँ

/ के लिए प्रत्यक्ष अनुरोध करने के क्रम में sitemap.xml एक कस्टम और अपने नियंत्रक कार्रवाई करने के लिए Zend फ्रेमवर्क आवेदन बस अपने application.ini या वैकल्पिक config फाइल में निम्नलिखित जोड़ें (जैसे मैं उपयोग navigation.ini):

 resources.router.routes.sitemap.route = "sitemap.xml"
 resources.router.routes.sitemap.defaults.controller = सूचकांक
 resources.router.routes.sitemap.defaults.action = साइटमैप

Outputting के लिए उदाहरण कोड उपयुक्त नियंत्रक (जैसे मेरे साइटमैप सूचकांक नियंत्रक, साइटमैप कार्रवाई में स्थित है) में एक कार्रवाई बनाने के द्वारा देखा जा सकता है:

 < php
 वर्ग IndexController
     Zend_Controller_Action फैली
 {
     / **
      * एक Zend_Navigation स्थापना पर आधारित साइटमैप को लाता है
      * /
     सार्वजनिक समारोह (sitemapAction)
     {
    	 ,> (साइटमैप) - $ इस -> दृश्य> नेविगेशन () गूंज
    	 $ इस -> दृश्य> (लेआउट) -> (disableLayout);
    	 $ इस -> _helper> viewRenderer> setNoRender (सच);
     }
 }

साइटमैप जल्दी और आसानी से प्रयोग कर उत्पन्न किया जा सकता है Zend_Navigation , एक महान त्वरित ट्यूटोरियल (और आम तौर पर बहुत Zend फ्रेमवर्क ट्यूटोरियल के लिए उपयोगी) Zend निर्मोक गतिशील रूप से एक मेनू एक साइटमैप और ब्रेडक्रंब बनाने .

Zend फ्रेमवर्क प्रति मॉड्यूल आधारित सेटिंग्स

द्वारा , शुक्रवार को 1 जनवरी 2010 10:40 बजे

मैं इस पोस्ट है जो कम विन्यास की आवश्यकता के लिए एक follow बनाया है, कृपया देखें Zend फ्रेमवर्क - मॉड्यूल आधारित लेआउट .

Zend फ्रेमवर्क का उपयोग मॉड्यूल, इसके स्पष्ट है कि अगर आप एक ही आवेदन से विभिन्न (उप) साइटों को चला रहे हैं आप जरूरी ही नहीं करना चाहती के साथ लेआउट लिपियों प्रत्येक भाग के लिए. मैं निम्नलिखित साइट संरचना के साथ जाने का फैसला किया:

  / आवेदन
     / नियंत्रकों
         ...
     / मॉडल
     / मॉड्यूल
         / डिफ़ॉल्ट
             / नियंत्रकों
             / लेआउट
                 / लिपियों
             / देखा गया
                 / लिपियों
         / AnotherModule
             ...
     / लिपियों

समस्या एक प्रति मॉड्यूल के आधार पर स्थापित किया गया लेआउट स्क्रिप्ट. जवाब एक कार्य हेल्पर का उपयोग कर के माध्यम से आया था. प्रति मॉड्यूल के आधार पर लेआउट की स्थापना के तीन चरण होते हैं:

  1. Application.ini (या इसी तरह के विन्यास सेटअप):
      admin.resources.layout.layoutPath = APPLICATION_PATH / मॉड्यूल / व्यवस्थापक / लेआउट / लिपियों "
     = default.resources.layout.layoutPath APPLICATION_PATH "/ मॉड्यूल / डिफ़ॉल्ट / लेआउट / लिपियों"
     = member.resources.layout.layoutPath APPLICATION_PATH "/ मॉड्यूल / / सदस्य लेआउट / लिपियों"
     affiliate.resources.layout.layoutPath = APPLICATION_PATH "मॉड्यूल / / / सहबद्ध / लेआउट स्क्रिप्ट" 
  2. आपके लड़ाई हेल्पर बनाएँ:
      <Php?
     / **
      * एक प्रति मॉड्यूल के आधार पर लेआउट पथ सेट करें
      *
      * लेखक @ लॉयड Watkin <lloyd@evilprofessor.co.uk>
      * @ 2010/01/01 के बाद
      * /
     वर्ग Pro_Controller_Action_Helper_SetLayoutPath
         Zend_Controller_Action_Helper_Abstract फैली
     {
         / **
          * सेट लेआउट मॉड्यूल पर आधारित पथ
          * /
         सार्वजनिक समारोह (preDispatch)
         {
        	 $ मॉड्यूल = $ इस -> getRequest () -> getModuleName ();
    
    	     अगर ($ बूटस्ट्रैप = ​​$ इस -> (getActionController)
    	                        -> GetInvokeArg (बूटस्ट्रैप ')) {
    
    	         Config के $ = bootstrap -> $ getOptions ();
    
    	         अगर (isset ($ config [मॉड्यूल $] ['संसाधन'] ['लेआउट'] ['layoutPath'])) {
    	             LayoutPath डॉलर =
    	                  कॉन्फिग डॉलर [$ मॉड्यूल] ['संसाधनों'] ['लेआउट' ['layoutPath,'];
    	             $> इस (getActionController)
    	                  -> GetHelper ('लेआउट')
    	                  -> SetLayoutPath (layoutPath $);
    	         }
        	 }
         }
     } 
  3. और अंत में कार्रवाई सहायक बूटस्ट्रैप:
      ...
         / **
          * प्रति मॉड्यूल के आधार पर लेआउट स्क्रिप्ट समूह
          * /
         संरक्षित समारोह (_initLayoutHelper)
    	 {
    	     इस -> बूटस्ट्रैप $ ('frontController');
    	     $ लेआउट = :: Zend_Controller_Action_HelperBroker एडहेल्पर (
    	         नई Pro_Controller_Action_Helper_SetLayoutPath ());
    	 }
     ... 

सिद्धांत: datetime अब डिफ़ॉल्ट ()

द्वारा , बुधवार 30 दिसम्बर 2009 6:30

मैं के लिए एक नया डेटाबेस स्कीमा की स्थापना के साथ संघर्ष कर रहा हूँ Zend फ्रेमवर्क परियोजना. मैं कर रहा हूँ का उपयोग उपयोग करने की कोशिश कर अपने डेटाबेस मॉडल के लिए सिद्धांत ORM. मैं इतना है कि यह मुझे एक `` datetime स्तंभ के लिए एक डिफ़ॉल्ट दिनांक और समय सेट करने के लिए अनुमति दी, जैसे जब एक नया संदेश मैं वर्तमान टाइमस्टैम्प जोड़ने स्कीमा सेट की जरूरत है. बहुत खोज और प्रयोग करने के बाद मैं हल मिल गया तो मैं इसे साझा कर रहा हूँ.

बस अपने स्कीमा में YAML फ़ाइल निम्न कार्य करें:

 संदेश:
   actAs:
     Timestampable:
       निर्मित:
         नाम: created_at
         प्रकार: टाइमस्टैम्प
         प्रारूप: Ymd एच: मैं:
       अद्यतन:
         नाम: last_updated
         प्रकार: टाइमस्टैम्प
         प्रारूप: Ymd एच: मैं:
   कॉलम:
     आईडी:
       प्रकार: पूर्णांक
       प्राथमिक: सच
       autoincrement: सच
     नाम: स्ट्रिंग (255)
     ईमेल: स्ट्रिंग (300)
     संदेश: स्ट्रिंग (2000)

अगर दूसरे हाथ पर आप एक `updated_at` स्तंभ नहीं करना चाहती आप निम्नलिखित का उपयोग कर सकते हैं:

 संदेश:
   actAs:
     Timestampable:
       निर्मित:
         नाम: created_at
         प्रकार: टाइमस्टैम्प
         प्रारूप: Ymd एच: मैं:
       अद्यतन:
         विकलांग: सच
   कॉलम:
     आईडी:
       प्रकार: पूर्णांक
       प्राथमिक: सच
       autoincrement: सच
     नाम: स्ट्रिंग (255)
     ईमेल: स्ट्रिंग (300)
     संदेश: स्ट्रिंग (2000)

प्रेक्षक पैटर्न PHP डिजाइन पैटर्न

द्वारा , मंगलवार 29 दिसम्बर 2009 10:02 बजे

मैं पढ़ रहा हूँ सिर पहले डिजाइन पैटर्न हाल ही में और अपने स्वयं के लाभ के लिए PHP उदाहरण के रूप में पैटर्न में से कुछ लिखने का फैसला किया है. पहले एक है कि मैं कोड का फैसला किया है प्रेक्षक पैटर्न है . प्रेक्षक पैटर्न की औपचारिक परिभाषा है:

पर्यवेक्षक पैटर्न (अतुल्यकालिक की एक सबसेट प्रकाशित / पैटर्न सदस्यता ) एक सॉफ्टवेयर डिजाइन पैटर्न में जो एक वस्तु , विषय में कहा जाता है, अपने आश्रितों, पर्यवेक्षकों कहा जाता है की एक सूची रखता है, और उन्हें स्वचालित रूप से फोन करके आमतौर पर किसी भी राज्य में परिवर्तन की अधिसूचित, उनके तरीकों . यह मुख्य रूप से वितरित की घटना से निपटने के सिस्टम को लागू करने के लिए प्रयोग किया जाता है.

के रूप में सिस्टम बन जाते हैं और अधिक शिथिल ने बताया कि जब एक घटना में सभी प्रणालियों कि इन अद्यतनों के ज्ञान की आवश्यकता होती है होता है सुनिश्चित करने युग्मित. उदाहरण के लिए, एक ब्लॉग पोस्ट, एक के बाद बचत के बाद हम एक खोज इंजन अद्यतन (Lucene उदाहरण) की आवश्यकता हो सकती है, हमारे साइटमैप, टैग, ईमेल सदस्यता उपयोगकर्ताओं, आदि अद्यतन पर्यवेक्षक पैटर्न डेवलपर्स उनके प्रत्यक्ष वस्तु संपादन के बिना अतिरिक्त श्रोताओं को जोड़ने के लिए अनुमति देता है . एक विषय (यानी ब्लॉग पोस्ट संपादन प्रणाली) में पर्यवेक्षकों (अर्थात् एक खोज इंजन अद्यतन पर्यवेक्षक, एक साइटमैप जनरेटर, आदि) इंजेक्शन लगाने के द्वारा हम यह किसी भी बदलाव के बिना सभी आवश्यक अद्यतन करने के लिए अनुमति दे सकते हैं.

जारी रखें पढ़ने 'PHP डिजाइन पैटर्न प्रेक्षक पैटर्न' »

कार्यालय ग्रिड आभासी वातावरण का उपयोग कम्प्यूटिंग - भाग 4

द्वारा , शुक्रवार 4 दिसम्बर 2009 11:59

परिचय

मैं एक कंपनी में काम करते हैं जहां हम कई बैच नौकरियों के लाखों प्रत्येक दिन डेटा के रिकॉर्ड के प्रसंस्करण और मैं सभी मशीनों है कि प्रत्येक और हर दिन के आसपास बैठते हैं कई घंटे के लिए कुछ भी नहीं करने के बारे में किया गया है हाल ही में सोच चलाने के. यह अच्छा नहीं होगा अगर हम उन मशीनों का उपयोग करने के लिए हमारे सिस्टम के प्रसंस्करण शक्ति बढ़ा सकती है? लेख के इस सेट में मैं एक कार्यालय रोजगार के संभावित लाभ को देखने के लिए जा रहा हूँ ग्रिड virtualised वातावरण का उपयोग कर.

इन भाग 3 हम हमारे आभासी प्रसंस्करण मशीन बनाई और सेट अप विंडोज़ मशीनों के लिए निष्क्रिय समय श्रमिकों बनने.

नवीनतम कोड चल रहा है

अनिवार्य रूप से अपने कार्यकर्ताओं व्यापार तर्क बदल जाएगा बनाने के बाद, कीड़े पाया जाएगा, तेजी से और अधिक कुशल कोड इस प्रकार अपने कर्मचारियों का उपयोग कर डेटा के प्रसंस्करण के चारों ओर बैठ छोड़ने का उत्पादन किया जाएगा पुराने बदबूदार कोड . तो कैसे हम यह सुनिश्चित करना है कि हम हमेशा हमारे प्रसंस्करण लिपियों के और सबसे नवीनतम संस्करण का उपयोग कर रहे हैं?

वहाँ कुछ बहुत आसान सरल तरीके से हम यह कर सकता है, चाल, तथापि, इस को प्राप्त करने में प्रसंस्करण शक्ति और नेटवर्क यातायात को कम करने के लिए है. सरल समाधान के साथ शुरू और पुनरावृत्तियों के एक जोड़े में धीरे धीरे सुधार की सुविधा देता है.

पहली विधि केवल हमारे काम पर नियंत्रण (साम्बा, FTP, या इसी तरह के) के माध्यम से सर्वर से कनेक्ट करने के लिए और नीचे कोड के नवीनतम संस्करण खींच होगा. नहीं कुशल बहुत है, लेकिन यह काम करना होगा. चलो पर कि कुछ हद तक सुधार, कैसे एक rsync के स्क्रिप्ट बनाने और है कि हर बार के बजाय का उपयोग करने के बारे में? वैकल्पिक रूप से क्या तोड़फोड़ कोड बाहर की जाँच शुरू में हमारे नवीनतम प्रसंस्करण स्क्रिप्ट डाल और तब प्रत्येक भाग (पर हमारे कोड को अद्यतन करने के बारे में svn अद्यतन )?

अंत में हम एक bash स्क्रिप्ट (क्रॉन द्वारा हर 10 मिनट में कहा जाता है) जो के रूप में इस के रूप में सरल लग रहा है के साथ खत्म हो सकता है:

  # / Bin / श
 अगर पी एस कुल्हाड़ी | grep कि grep-v | grep php > / dev / बातिल
 फिर
     गूंज "नौकरी वर्तमान में, बाहर निकलने के प्रसंस्करण है"
 अन्य
     गूंज "नौकरी नहीं चल रहा है, अब शुरू
     सीडी पथ / / / / प्रतिलिपि काम
     svn अद्यतन
     php के yourJobProcessingScript.php
 इंटरनेट 

अब हमें यकीन है कि प्रत्येक रन के साथ हम निश्चित रूप से नवीनतम कोड चला रहे हैं हो सकता है. हम हमारे कोड के आधार पर प्रत्येक और हर बार हम एक रन के प्रदर्शन को अद्यतन करने और केवल हमारे नेटवर्क पर फ़ाइल मतभेद के हस्तांतरण से नेटवर्क यातायात को कम करने के द्वारा यह सुनिश्चित कर रहे हैं.

मेरे प्रदर्शन सेटअप में, मैं इसके बाद के संस्करण के रूप में ठीक किया. तोड़फोड़ मेरी नौकरी प्रसंस्करण सर्वर पर स्थापित किया गया था और मैं बस एक 'कार्यकर्ता' शाखा 'svn अद्यतन' का उपयोग नवीनतम कोड से खींच लिया. मैं भी जो परिणाम के भाग के रूप में डेटाबेस से लौट रहा था मेरे प्रसंस्करण स्क्रिप्ट के लिए एक संस्करण संख्या टैग जोड़ा. इस तरह मैं देख सकता था कि मेरे कोड हर बार जब मैं कार्यकर्ता शाखा अर्थात् में मेरी ट्रंक की नकल की है कि मैं निश्चित रूप से नवीनतम प्रसंस्करण स्क्रिप्ट चल रहा था अद्यतन किया जा रहा था.

नवीनतम डेटा का उपयोग करना

यदि आपकी नौकरी प्रसंस्करण कुछ बिंदु पर डेटा स्रोतों का उपयोग बनाता है तो इन को भी अद्यतन किया जा करने जा रहे हैं. जब तक आप एक बहुत निराला है आप यातायात के साथ अपने नेटवर्क के रूप में जल्द ही बाढ़ के रूप में अपने कर्मचारियों को एक ठहराव के लिए सब कुछ लाने शुरू करने जा रहे हैं आधार पर अपने डेटा स्रोतों कहते हैं. मैं अपने समाधान के लिए तय किया है कि मैं मेरे डेटा स्रोतों मेरे वी एम एस के साथ चारों ओर ले जाने के लिए करना चाहते हैं.

पकड़ तुम घोड़े वहाँ हो! क्या होगा अगर मेरे डेटा स्रोत विशाल कर रहे हैं? अच्छी तरह से यह वास्तव में कितना डेटा हम बात कर रहे हैं का एक मामला है? यह अधिक प्रत्येक मशीन में एक अतिरिक्त बड़ा हार्ड ड्राइव को स्थापित करने से एक अतिरिक्त संसाधन सर्वर की खरीद के लिए लागत प्रभावी हो सकता है. इस बजट का एक सवाल है और तय करने के लिए व्यापार करने के लिए ऊपर है. यह हो सकता है कि आपके डेटा स्रोतों इतनी बड़ी हैं कि अपनी बस के लिए अपने कार्यकर्ता मशीनों में डेटा की है कि राशि रखने के लिए unfeasible है. उस मामले में आप क्या करेंगे? खैर, हम एक स्थानीय डेटा सर्वर बुला देखो सकता है, लेकिन इस नेटवर्क के साथ मुद्दों के कारण हो सकता है. इस मामले में इस तरह के रूप में एक ग्रिड प्रणाली के लिए अपने कार्यालय वातावरण में शामिल अवास्तविक हो सकता है. यह भी हो सकता है कि आप चल वैकल्पिक रणनीतियों में देखो, उदाहरण के लिए कर सकते हैं केवल 20:00 और 06:00 के बीच हर रात और / या थ्रॉटलिंग डेटा स्रोत अनुरोध अपने कर्मचारियों को बुला सकता है.

सुविधा देता है पर चल रहा है 100Gb डेटा के लिए हमारे डेटा स्रोतों राशि कहते हैं. खैर हाँ है कि डेटा की काफी एक बिट के लिए एक अद्यतन के नेटवर्क पर कदम के आसपास है. हम यह कैसे सुनिश्चित होगा कि हम इस मामले में डेटा की प्रतिलिपि है? Rsync एक संभावना है, लेकिन व्यक्तिगत रूप से मुझे लगता है कि अपनी नौकरी प्रसंस्करण सर्वर पर अपने नवीनतम डेटा स्रोत चल रहा है और इस प्रतिकृति (एक अच्छा समय बिन प्रवेश के साथ) में एक मास्टर के रूप में स्थापित करने से जाने के लिए रास्ता हो सकता है:

प्रतिकृति अपने कर्मचारियों में से प्रत्येक के एक दास के रूप में स्थापित करने के काम पर नियंत्रण सर्वर अद्यतन करने के लिए अपने डेटा स्रोतों से नीचे अच्छी तरह से अपने कर्मचारियों को मिलने नेटवर्क गतिविधि में भारी वृद्धि के बिना (है कि जब तक आप एक बड़ा डेटा अद्यतन करते हैं और अपने सभी कार्यकर्ताओं में लात एक ही बार में). यह rsync के प्रयोग से अधिक फायदे में है कि आप हर काम से पहले एक लंबे विराम नहीं मिलेगा, डेटाबेस अद्यतन के रूप में, mysql अपने कार्यकर्ता पर डेमॉन लगातार अपने डेटा अद्यतन जबकि प्रसंस्करण जारी है.

यह कैसे मैं अपने प्रदर्शन सर्वर सेट. प्रतिकृति सेट मैं mySQL साइट (पर गाइड का पालन प्रतिकृति की स्थापना ) और 20 मिनट के भीतर मैं मेरे inital काम नियंत्रण सर्वर डाटासेट नकल कार्यकर्ता था. प्रत्येक अतिरिक्त कार्यकर्ता के लिए प्रतिकृति सेटिंग्स और प्रक्रिया में हर समय काम किया जब वी एम नकल की थी.

सारांश

लेख के इस खंड में हम कैसे यह करने के लिए आसान है और पीड़ारहित अपने प्रसंस्करण कोड रखने rsync के using या subverion (SVN) द्वारा तिथि करने के लिए काम करते हैं और वही time. में नेटवर्क यातायात को कम करने पर ध्यान दिया है हम भी कैसे पर चर्चा की यह नीचे अपने कर्मचारियों में से प्रत्येक के लिए मिलने के लिए अनुमति देकर अपने डेटा स्रोत से तारीख जानकारी रखने के लिए. इस प्रकार हम क्षेत्र सुनिश्चित करना है कि हम व्यापार तर्क और हमारे कार्यालय ग्रिड प्रणाली में जानकारी के साथ रखने के. जाहिर है इन कार्यों का प्रदर्शन करने के लिए अनगिनत विकल्प हो जाएगा, लेकिन यहाँ दो सरल उदाहरण को दिखाने के लिए कि कैसे एक आसान समाधान से आने थे.

अगली बार

इस श्रृंखला है, जिसे उपयुक्त नाम के अंतिम भाग 5 भाग में , हम के लिए इस प्रणाली की तैनाती पर चर्चा करेंगे. मैं संक्षेप में प्रस्तुत करेंगे सीखा गया है और क्या मैं बनाने में कामयाब रहे.

कार्यालय ग्रिड आभासी वातावरण का उपयोग कम्प्यूटिंग - भाग 3

द्वारा , शुक्रवार 4th दिसंबर 2009 11:37 बजे

परिचय

मैं एक कंपनी में काम करते हैं जहां हम कई बैच नौकरियों के लाखों प्रत्येक दिन डेटा के रिकॉर्ड के प्रसंस्करण और मैं सभी मशीनों है कि प्रत्येक और हर दिन के आसपास बैठते हैं कई घंटे के लिए कुछ भी नहीं करने के बारे में किया गया है हाल ही में सोच चलाने के. यह अच्छा नहीं होगा अगर हम उन मशीनों का उपयोग करने के लिए हमारे सिस्टम के प्रसंस्करण शक्ति बढ़ा सकती है? लेख के इस सेट में मैं एक कार्यालय रोजगार के संभावित लाभ को देखने के लिए जा रहा हूँ ग्रिड virtualised वातावरण का उपयोग कर.

2 में हिस्सा हम एक सर्वर चलेंगे नौकरियों पर देखा है, और कैसे नौकरियों क्रम में करने के लिए सुनिश्चित करना है कि हर काम के असफल बिना संसाधित है whilst प्रसंस्करण की सबसे बड़ी राशि प्राप्त करने के लिए कॉन्फ़िगर किया जाना चाहिए.

या लंगड़ा सर्वर के अपने कार्यकर्ता की स्थापना

इस प्रक्रिया में अगला कदम अपने आभासी कार्यकर्ताओं सेट है. मैं इस के लिए VirtualBox का उपयोग CentOS की स्थापना का उपयोग करने के लिए जा रहा हूँ. मैं स्थापित करने जा रहा हूँ MySQL और PHP सर्वर भी एक लंगड़ा (ली nux, एम ySQL, पी हिमाचल प्रदेश) SERVERA (मैं नाम है कि हो सकता है) के रूप में जाना जाता है पर.

  • अपने विंडोज़ मशीन पर स्थापित VirtualBox (लिंक का पालन करें)
  • डाउनलोड और बनाया आभासी मशीन के भीतर CentOS (मौजूदा 5.3 संस्करण) स्थापित

वहाँ कोई मतलब नहीं है मुझे इस के लिए जा रहा वहाँ शायद वहाँ से बाहर महान ट्यूटोरियल (ठीक है, यहाँ एक है की 1000 के बनाना और VirtualBox के तहत Managing CentOS आभासी मशीन ). मुझे लगता है ध्यान दें करने के लिए महत्वपूर्ण मुद्दा है कि मैं अपने आभासी मशीन GridMachine कहा जाता है.

जहाँ तक वर्चुअलाइजेशन ग्राहक और ऑपरेटिंग सिस्टम की मेरी पसंद जाना वहाँ प्रत्येक चुनाव के लिए कोई बड़ा सम्मोहक कारण है. VirtualBox के कुछ मैं मेरे घर मशीन पर प्रयोग है और तीन प्रमुख ऑपरेटिंग सिस्टम के द्वारा समर्थित है. मैं इसकी एक अच्छी स्थिर ओएस के रूप में CentOS चुना है और मैं इसे अपने स्वयं के वेब सर्वर पर उपयोग करें. मैं काम के लिए सही उपकरण में एक महान आस्तिक हूँ (हालांकि मैं आवेदन कर रहा हूँ यहाँ मानसिकता 'तेज और आप के लिए सबसे आसान का उपयोग करें'), यदि ऐसा है तो ऑपरेटिंग सिस्टम एक्स अपने कोड को तेज चलाता है और अधिक कुशलता से कि :) बजाय का उपयोग करें

महत्वपूर्ण बात यह सुनिश्चित करें कि आपके वीएम DHCP का उपयोग करता है, प्रत्येक नई आभासी मशीन के लिए अन्यथा करने के लिए अलग से विन्यस्त करने की आवश्यकता है जो कुछ हम want.By DHCP के उपयोग नहीं कर हम करने के लिए नेटवर्क सेटिंग्स कार्यकर्ता मशीनों के लिए व्यक्तिगत कॉन्फ़िगर की जरूरत नहीं है, DHCP के हाथ में कर देगा आप के लिए आईपी बाहर. इसलिए आप हर एक स्थापित करने के (इस scalability के सुधार और कार्यकर्ता प्रशासन को कम कर देता है) के बारे में चिंता किए बिना अपने कार्यालय के बारे में आभासी मशीन की नकल कर सकते हैं.

प्रक्रिया को प्राप्त करने का लक्ष्य रखना चाहिए एक नया शारीरिक मशीन, VirtualBox स्थापित प्राप्त करने के लिए, और फिर बहुत ज्यादा बहुत कुछ बिना आभासी छवि को तैनात किया जाएगा. यह एक अलग subnet पर अपने सभी कार्यकर्ताओं सेटअप इतना है कि आप कम से कम देखने के लिए कितने मशीनों चल रहे हैं कर सकते हैं बुद्धिमान हो सकता है. तुम भी एक लंबे पट्टे या असीमित पट्टे DHCP के पर अपने मशीनों को सेट करने की आवश्यकता होगी.

कार्यकर्ता पर नौकरियां चलाने के लिए

यह एक दिलचस्प क्षेत्र है और वहाँ कई कार्यकर्ता पर नौकरी के प्रसंस्करण के लिए वैध तरीके हैं. यहाँ मैं सिर्फ दो सबसे स्पष्ट चर्चा करेंगे:

  • सदा स्क्रिप्ट चलाने: एक स्क्रिप्ट है, यह एक खोल स्क्रिप्ट, या एक PHP स्क्रिप्ट एक बार कार्यकर्ता पर मार डाला है और एक अनंत लूप के भाग के रूप में चलाता है. मैं स्क्रिप्ट की एक दुर्घटना के रूप में इस विधि को छूट है, और संभवतः अपने कार्यकर्ताओं के हस्तक्षेप के कुछ प्रकार के बिना चलाने के लिए संघर्ष करेंगे.
  • क्रॉन आधारित स्क्रिप्ट निष्पादन: हर एक्स मिनट क्रॉन डेमॉन अपनी स्क्रिप्ट के लिए एक कॉल बातें जा पाने के बंद kicks. कुछ जाँच के बिना अपने कार्यकर्ता स्क्रिप्ट चल रहा है की कई कई प्रतियां ले सकता है.

मेरा निर्णय था क्रॉन साथ जाने के लिए जो एक खोल स्क्रिप्ट से हर 10 minutes. मेरा खोल स्क्रिप्ट निम्न कार्य करता है बंद kicks:

  1. एक प्रक्रिया सूची और 'PHP' के लिए इस grep. अगर नहीं मिला तो जारी है.
  2. अपनी नौकरी कोड को बुलाओ, मेरे मामले में यह कुछ PHP आधारित होता है
  3. कार्यकर्ता स्क्रिप्ट अपनी दौड़ पूरी
  4. अगले उपयुक्त फोन पर फिर से जाने के लिए तैयार

मेरा bash स्क्रिप्ट निम्नलिखित की तरह कुछ दिखता है:

  # / Bin / श
 अगर पी एस कुल्हाड़ी | grep कि grep-v | grep php> / dev / बातिल
 फिर
     गूंज "नौकरी वर्तमान में, बाहर निकलने के प्रसंस्करण है"
 अन्य
     गूंज "नौकरी नहीं चल रहा है, अब शुरू
     php के yourJobProcessingScript.php
 इंटरनेट 

नोट: गूंज लगभग पूरी तरह से व्यर्थ हैं, लेकिन अगले व्यक्ति जो साथ आता है के लिए प्रयास करें और उन्हें संपादित मदद कर सकते हैं.

कि कार्यकर्ता आभासी मशीन, त्वरित, सरल, और हार्डवेयर के प्रत्येक नए टुकड़ा है कि प्राप्त होता है को कॉपी करने के लिए आसान सेट अप निष्कर्ष निकाला है. ग्रिड प्रणाली की 'चतुराई' वास्तव में कल्पना ओएस में नहीं है इसकी प्रक्रिया रोजगार, नौकरी, और विन्यास के लिए बनाई गई कोड के साथ करने के सभी सुनिश्चित करने कि काम चलाता है जब उपयुक्त (यानी जब मेजबान निष्क्रिय है में ).

विंडोज स्थापना श्रमिक आरंभीकृत

पहला काम खिड़कियां कमांड लाइन से आभासी मशीन चलाने के लिए आवश्यक आदेश काम है. यदि आप डिफ़ॉल्ट स्थान में VirtualBox स्थापित किया है और आप अपने कार्यकर्ता GridMachine नाम है तो आदेश अपने कार्यकर्ता को लोड करने के लिए आवश्यक है:

  "C: \ Program Files \ रवि \ VirtualBox \ VBoxManage.exe" startvm GridMachine 

लेकिन एक 'नेतृत्वहीन' राज्य में स्क्रिप्ट चलाने के हम का उपयोग करने की जरूरत है:

  "C: \ Program Files \ रवि VirtualBox के \ \ VBoxHeadless.exe" startvm GridMachine - vrdp = बंद 

इस जीयूआई बिना आभासी मशीन शुरू और यह राज्य को बचाने के लिए इनायत की अनुमति देगा. दूसरा तर्क RDP तो यह विंडोज़ RDP के साथ संघर्ष नहीं करता है, या आप 3389 पोर्ट पर सुनने के बारे में एक संदेश दे आभासी मशीन नाम केस संवेदी है.!

अगला, हम खिड़कियों को सेट अप करने की आवश्यकता के लिए रवाना हमारे कार्यकर्ता वी एम लात एक बार मशीन निष्क्रिय कर दिया गया है हूँ. > सभी कार्यक्रम -> सहायक उपकरण -> सिस्टम उपकरण करने के लिए Windows XP पर आप प्रारंभ जाने की आवश्यकता होगी नीचे के रूप में अनुसूचित टास्क:

अनुसूचित कार्य

पर अगला पर क्लिक करें एक कस्टम प्रोग्राम को जोड़ने के लिए ब्राउज़ के बाद 'अनुसूचित टास्क जोड़ें. अपने VBoxManage स्क्रिप्ट को नेविगेट करें और ठीक क्लिक करें. विकल्पों में से किसी भी (हम एक मिनट में बदल देंगे) के लिए अपने काम अनुसूची और जारी है. अगले स्क्रीन लंघन के बाद विंडोज़ आप पूछते हैं कि तुम जो इस कार्य को चलाने के लिए चाहते हो जाएगा, मैं या तो 'प्रशासक' या एक नई विशेषाधिकृत उपयोगकर्ता बनाने का सुझाव था. याद रखें कि हम किसी भी बिंदु पर मशीन पर मानक स्टाफ खाते के साथ हस्तक्षेप नहीं करना चाहती. अगला पर क्लिक करें और इस कार्य के लिए शो उन्नत विकल्पों की जाँच करें.

रन पाठ बॉक्स के अंत करने के लिए हमारे 'startvm GridMachine' स्ट्रिंग जोड़ सकते हैं और कि रन सुनिश्चित करने के केवल जब unticked में छोड़ दिया है लॉग. अनुसूची कार्य अगले पर जाएँ और परिवर्तन अनुसूची विकल्प के लिए ड्रॉप डाउन 'निष्क्रिय', समय की राशि है जो आप मशीन अगले टैब पर जाने से पहले निष्क्रिय करना चाहते हैं का चयन.

अंत में विकल्प है जो काम रोक कहा गया है अगर यह समय की एक्स राशि से चल रहा है untick, लेकिन अगर मशीन नहीं रह गया है निष्क्रिय कार्य को रोकने के विकल्प टिकटिक.

अनुसूची

कि यह तो विंडोज़ मेजबान स्थापना के लिए!

सारांश

इस भाग में हम एक आभासी मशीन के लिए एक कार्यकर्ता के रूप में अच्छी तरह से जिस तरह से जो हम फोन और हमारे काम प्रसंस्करण स्क्रिप्ट निष्पादित के रूप में कार्य निर्धारित किया है (अपने आप को एक PHP स्क्रिप्ट के लिए). यहाँ से हम खिड़कियों की प्रतियां कोई मुखिया मोड में आभासी मशीन शुरू करने के लिए जब कंप्यूटर निष्क्रिय हो जाता है, और अपने राज्य को बचाने के लिए जब उपयोगकर्ता मशीन का उपयोग शुरू कैसे स्थापित करने के लिए देखो. उम्मीद है कि आप इस बिंदु पर देख रहे हैं कैसे आसान यह एक ऐसी प्रणाली स्थापित कर रहे हैं और कुछ प्रयोगों अपने आप को जा रहा खुजली!

अगली बार

इन भाग 4 हम उपकरण का उपयोग करने के लिए सुनिश्चित करें कि आप कोड और डेटा स्रोतों के नवीनतम संस्करण चला रहे हैं इतना है कि प्राप्त परिणामों हमेशा नवीनतम व्यापार जानकारी और तर्क के साथ करने की तारीख पर देख सकता हूँ.

कार्यालय ग्रिड आभासी वातावरण का उपयोग कम्प्यूटिंग - भाग 1

द्वारा , शुक्रवार 4th दिसंबर 2009 11:23 बजे

परिचय

मैं एक कंपनी में काम करते हैं जहां हम कई बैच नौकरियों के लाखों प्रत्येक दिन डेटा के रिकॉर्ड के प्रसंस्करण और मैं सभी मशीनों है कि प्रत्येक और हर दिन के आसपास बैठते हैं कई घंटे के लिए कुछ भी नहीं करने के बारे में किया गया है हाल ही में सोच चलाने के. यह अच्छा नहीं होगा अगर हम उन मशीनों का उपयोग करने के लिए हमारे सिस्टम के प्रसंस्करण शक्ति बढ़ा सकती है? लेख के इस सेट में मैं एक कार्यालय रोजगार के संभावित लाभ को देखने के लिए जा रहा हूँ ग्रिड virtualised वातावरण का उपयोग कर.

मैं एक के रूप में PHP डेवलपर उपकरण है कि मैं हर दिन अर्थात् का उपयोग करें, लिनक्स, का उपयोग करने जा रहा हूँ mySQL , पीएचपी, VirtualBox और तोड़फोड़ (SVN). लेकिन मुझे आशा है कि इस गाइड अन्य भाषाओं और प्रौद्योगिकियों के लिए बस के रूप में अच्छी तरह से अनुकूल होगा.

समाधान मैं प्रदान बहुत शिथिल हम तथापि प्राप्त करने के इस पूरे लेख के माध्यम से सच नहीं हो सकता के रूप में मैं सादगी के लिए चीजों को बदलने के लिए, या अधिक दिलचस्प उपयोग परिदृश्यों का उत्पादन हो सकता है की आवश्यकता होगी प्रसंस्करण के प्रकार के आधार पर किया जाएगा.

इन virtualised वातावरण विंडोज़ मशीन पर चलने के बाद से यह है कि कार्यालयों के बहुमत क्या चलाने के. कि कार्यालय मशीनों प्रसंस्करण उन मशीनों का उपयोग करते हुए कर्मचारियों के साथ हस्तक्षेप नहीं करना चाहिए, मशीन पर कोई रखरखाव की आवश्यकता होती है, और आसानी से नई मशीनों के लिए तैनाती के रूप में वे उपलब्ध हो जाते हैं. इसके अलावा, नई वर्चुअल मशीन के किसी भी अतिरिक्त विन्यास की आवश्यकता के रूप में यह बहुत scalability और आसानी जिस पर ग्रिड प्रणाली बढ़ाया जा सकता है कम कर देता है चाहिए.

क्यों एक कार्यालय कंप्यूटिंग ग्रिड तैनात?

सबसे पहले आप सोच हो सकती है, क्यों के रूप में एक बादल कंप्यूटिंग संसाधन नहीं अमेज़न EC2 मंच का उपयोग करें ? कई कारणों से अच्छी तरह से उदाहरण के लिए, हो सकता है:

  • आप एक बादल अभिकलन वातावरण के लिए कुछ डेटा नहीं सौंपना होगा
  • आप एक बादल अभिकलन वातावरण में कुछ डेटा नहीं कानूनी कारणों (जैसे डेटा देश छोड़ने) के लिए रख सकते हैं संभावित कानूनी कारणों, जैसे एन एच एस रिकॉर्ड के लिए.
  • आप अपने प्रसंस्करण इकाइयों को बंद करने और हार्डवेयर पर पूरा नियंत्रण भी रखना चाहते हैं
  • तुम परियोजना धन नहीं है बादल उदाहरण चलाने
  • अपने कार्यालय इंटरनेट से एक कनेक्शन नहीं है और इसलिए संभव नहीं है अपने एक बादल संसाधन का उपयोग
  • तुम बारिश पसंद नहीं है, बादल, बारिश का सुझाव है, इसलिए आप अच्छी तरह से दूर रखना

मुझे यकीन है कि सूची जारी रखने के सकता हूँ, लेकिन मुझे लगता है कि अब के लिए काफी है.

किसी Office कंप्यूटिंग ग्रिड का लाभ

अच्छी तरह से देता है, कुछ गणित (और सच भौतिकी शैली में कुछ व्यापक मान्यताओं बनाने की सुविधा देता है). कल्पना कीजिए कि आप बड़े मांसल प्रसंस्करण प्रति दिन 100 नौकरियों को चलाने वाले किसी सर्वर है. आप अपने कार्यालय में 50 मशीन है जो 16 घंटे एक दिन बेकार हैं, इन मशीनों के प्रत्येक आपके मांसल प्रसंस्करण तोड़ के रूप में शक्तिशाली रूप में 10% है. (सभी परिणाम यहाँ प्रदर्शन वृद्धि बहुत मूल्यवान समझना के लिए गोल कर रहे हैं).

तो, 1 मशीन * 10% शक्ति * समय 2/3 = 0.067 यानी 1 डेस्कटॉप प्रसंस्करण निष्क्रिय समय में प्रति दिन 6 पूर्ण रोजगार की प्रक्रिया सकता है.

यदि आप अब इस पैमाने पर यह 15 निष्क्रिय डेस्कटॉप लेता प्रति दिन के रूप में कई काम की प्रक्रिया के रूप में अपने मुख्य प्रसंस्करण सर्वर करता है.

तो हम हमारे 50 मशीनों के नाटक कार्यालय में एक सर्वर से 4 पूर्ण प्रसंस्करण सर्वर के लिए हमारे प्रसंस्करण शक्ति में वृद्धि कर सकता है या हम प्रति दिन 400 नौकरियों प्रसंस्करण किया जा सकता है 100 के बजाय.

नए हार्डवेयर में कोई निवेश के लिए सूचना, आपकी कंपनी सिर्फ अपने बैच प्रसंस्करण क्षमता 4 गुना बढ़ गया है! संभवतः आप अपने बिजली के उपयोग को बढ़ाने जा रहे हैं, लेकिन अधिकांश कार्यालय वातावरण से मैं मशीनों के लिए किया गया है आम तौर पर रात भर पर कर रहे हैं वैसे भी छोड़ दिया है, तो आप एक हरे रंग की पहल के रूप में देख सकता है.

अन्य लाभ यह भी मतलब है नया में कि निवेश (या अद्यतन) प्रसंस्करण सर्वर अगर अपने कार्यालय मशीनों के लिए पर्याप्त हैं और के रूप में आप अपने कार्यालय मशीनों की शक्ति में सुधार अपने कार्यालय ग्रिड को और अधिक शक्तिशाली स्वतः हो जाता है कि विलंब हो सकता है.

टेक्नोलॉजीज

तुम क्या जरूरत है? (या अधिक सही ढंग से मैं क्या उपयोग किया)

  • निष्क्रिय कार्यालय मशीनों (मेरे मामले में एक अतिरिक्त पुराने Windows XP लैपटॉप)
  • VirtualBox के (या अन्य वर्चुअलाइजेशन ग्राहक सॉफ्टवेयर)
  • PHP, mySQL running ओएस नीचे चल रहा है एक कट के साथ एक आभासी मशीन, मैं इन मेरे लंगड़ा सर्वर :) बुला रहा हूँ
  • चलाने के नौकरियां
  • नौकरी सर्वर (एक और आभासी मशीन कहीं हो सकता है)

ठेठ नौकरियां

नौकरियों के प्रकार है कि इस प्रणाली को चलाने के लिए डिज़ाइन किया गया है इस प्रकार है:

  • प्रणाली डेटा जिस पर हम मैच और परिणाम देते हैं की जरूरत है की एक सूची प्राप्त
  • मिलान की जाँच / कई (काफी स्थिर) डेटा स्रोतों की खोज शामिल है
  • डेटा स्रोतों से परिणाम आगे सत्यापन की आवश्यकता है, विलय, परिणामों के जवाब में अतिरिक्त डेटा स्रोतों की जाँच कर सकते हैं
  • डाटा मिलान रिकॉर्ड के साथ वापस आ रहा है, पूरी तरह से मान्य और संसाधित
  • एक नौकरी के भीतर प्रत्येक रिकॉर्ड के बाकी के स्वतंत्र है

तो बुनियादी तौर पर हम नौकरियों चल रहा है जो डेटाबेस lookups के एक मिश्रण है और कुछ संख्या crunching, एक कारोबारी माहौल में एक काफी ठेठ परिदृश्य की आवश्यकता पर देख रहे हैं.

ग्रिड समाधान केवल इस प्रकार की नौकरियों के प्रसंस्करण के लिए लाभप्रद नहीं हैं. असल में, जो स्वतंत्र इकाइयों में विभाजित किया जा सकता है किसी भी प्रक्रिया के समानांतर में चला जा सकता है. उदाहरण और अधिक जानकारी के लिए देखिए यह विकिपीडिया: ग्रिड कंप्यूटिंग , लेकिन प्रसिद्ध उदाहरण के एक जोड़े हैं SETI @ होम और BIONC . कंप्यूटिंग ग्रिड चलाने के लिए व्यवस्थाएं हैं, और इन में अच्छी तरह से देख लायक हैं.

हम क्या हासिल होगा?

इन लेखों के अंत तक मुझे पता चलता है कि एक कार्यालय ग्रिड तैनाती बेहद महंगा या समय लेने की जरूरत नहीं है उम्मीद है. मैं चर्चा करने जा रहा हूँ:

  • नौकरी नियंत्रण प्रणाली की स्थापना की, नौकरी विन्यास
  • एक उपयुक्त संसाधन आभासी मशीन बनाना
  • कैसे एक विंडोज़ मशीन पर सिस्टम सेटअप करने के लिए
  • सुनिश्चित करना आप नवीनतम कोड और डेटा का उपयोग कर रहे हैं
  • तैनाती और बेंच मार्किंग
  • आगे देख रहे हैं

मैं इमारत हो (ठीक है मैं बनाया है, तो यह लिखा है) एक उदाहरण के लिए एक स्थानीय मशीन पर Windows XP और मेरे 'GridMachine' आभासी मशीन का उपयोग कर अवधारणाओं परीक्षण आवेदन हूँ. मेरा काम - नियंत्रण सर्वर Fedora 11 मेरी मुख्य मशीन है जो चलाता होगा .

यह कोई तरीका नहीं में एक पूरी तरह से काम कर मजबूत प्रणाली के प्रदर्शन का मतलब है, एक प्रदर्शन का अधिक से दिखा रहा है कि इन बातों में समय का एक यथोचित कम अंतरिक्ष और कम कीमत पर प्राप्त किया जा सकता है पर चर्चा का मतलब. मुझे किसी भी टिप्पणी, सुधार, सुधार या भेजने के लिए स्वतंत्र महसूस कृपया और मैं अपना सर्वश्रेष्ठ करने के लिए इस लेख के लिए मैच के लिए अद्यतन रखेंगे.

अगली बार

2 में हिस्सा मैं काम नियंत्रण प्रणाली पर देख द्वारा शुरू करेंगे और कैसे नौकरियों में क्रम में करने के लिए सुनिश्चित करना है कि हर काम के असफल बिना संसाधित है whilst प्रसंस्करण की सबसे बड़ी राशि प्राप्त करने के लिए कॉन्फ़िगर किया जाना चाहिए देखो.

कार्यालय ग्रिड आभासी वातावरण का उपयोग कम्प्यूटिंग - भाग 2

द्वारा , शुक्रवार 4th दिसंबर 2009 11:23 बजे

परिचय

मैं एक कंपनी में काम करते हैं जहां हम कई बैच नौकरियों के लाखों प्रत्येक दिन डेटा के रिकॉर्ड के प्रसंस्करण और मैं सभी मशीनों है कि प्रत्येक और हर दिन के आसपास बैठते हैं कई घंटे के लिए कुछ भी नहीं करने के बारे में किया गया है हाल ही में सोच चलाने के. यह अच्छा नहीं होगा अगर हम उन मशीनों का उपयोग करने के लिए हमारे सिस्टम के प्रसंस्करण शक्ति बढ़ा सकती है? लेख के इस सेट में मैं एक कार्यालय रोजगार के संभावित लाभ को देखने के लिए जा रहा हूँ ग्रिड virtualised वातावरण का उपयोग कर.

In Part 1 I gave an overview of the system and technologies I will be using as well as discussed some of the potential reasons why you would want to create an office grid.

Job Control

If you're going to be running jobs then you're going to need some way to manage them. Your job control system (on your job server) needs to be really well thought out before even attempting to run an office grid. So firstly, what are the tasks for a job control system:

  • Hand out jobs upon request from workers
  • Tell workers what type of jobs to run
  • Track jobs
  • Ensure that jobs are only run once
  • Provide job data to workers, or at least tell them where to get it

The system also needs to be extensible, a solution that works for now in a single case may be extended to run several types of jobs as the business sees the worth in a grid solution. For example, jobs may gain priorities, more than one job type may exist (ie several code bases), eventually you may even run several different worker machines that are optimised for each type of job (although that does move away from the 'generic worker' idea). Always try to think about the future when developing systems, a short term vision can lead to longer term frustration and increased development time.

Job Server

We're going to need somewhere to control our jobs from, this should be the only system in your grid that has a fixed resource locator, be that an IP address, host name, URL (using internal DNS), etc. This is because the workers need to know where to look for jobs, workers need to find the job control system (not the job control system find the workers).

The job server itself doesn't really have a complicated task (in a basic system anyhow), it needs to store a list of jobs, hand out jobs, receive results, and subsequently store them for later retrieval. How these parts (such as 'hand out jobs') are defined can be very basic. Later on we can extend the system to include an administration interface to add, edit, delete, suspend jobs but this is beyond this exercise.

There is no reason whatsoever then that your job server could not be a virtual machine running within your main processing server provided it doesn't drain too many resources from it. The job server however does need high availability, if it goes down on a Friday evening you're going to lose a whole weekend of processing, potentially costing you a couple of weeks worth of processing time (when compared to your main processing server alone). You may want to consider putting your job server on a load balanced environment for high availability.

Basic Setup

The basic setup for our job server will consist of what I'm calling one of my LiMP servers (that is Li nux, m ySql, P HP). The code running on the workers will actually work out what jobs it can run by interacting with with job control system databases. Later on we could create a web service and actually hand out jobs rather than having the workers do the hard work themselves, but for now we'll continue using the KISS principle (Keep it Simple, Stupid!).

So, lets create three mySQL tables to deal with jobs. These will be `jobs`, `jobRecords`, and `jobResults`.

jobs table Here I'm using SQL Buddy a great little alternative to phpMyAdmin just because its easier to install on centOS (for others see: 10 Great alternatives to phpMyAdmin )

This table consists of 5 simple fields,

  • id: Uniquely identify the job
  • name: Could be a client reference, or any number of other identifiers
  • Status: You need to know where the job is at, eg
    • 0: Not started
    • 1: Picked up
    • 2: Completed
  • started_by: Who's started doing the job? This isn't entirely required but is a nice to have. I'd suggest tracking workers by their IP address on your network
  • started_at: When did the worker start the job? By tracking jobs that have not completed within X amount of time we know we need to pick up the job once again and start processing by another worker. Workers could stop processing/go offline for any number of reasons, power failure, crash, network loss, etc.

It is easy how this table could be extended with a few additional fields to allow for statistics tracking, a finish time column to see how long the job took, a counter to see how many workers picked up the job (obviously this needs to tend to 1), job priority, the list can go on and on. In more complex job scenarios it would be possible to specify how much memory the worker would need access to (and therefore only use suitable workers), or even what type of worker would be required.

Lets add a few example jobs:

example jobs

The next table again is quite simple to understand, these are our job records. They are linked to the main jobs table by a column `jobs_id`. The make up of this table very much depends on the data that you need to supply to your workers, lets make a very simple example where we have four columns:

  • id: ID of the record
  • name: Person's name
  • address: Person's address
  • jobs_id: The job ID that this record is linked to

The third and final table consists of a results table, it has much the same make up as our records table, and with the addition of some columns could be part of the records table:

  • job_record_id: Link the result to the job table
  • result: The result data

…and that's all you need for job control! (albeit at a very basic level) In my case I'm pointed to another table where my data to process was located, but this could just as easily been a file, parameters to run simulation code, you name it.

Selecting a job

As stated previously, the workers will do our job management for us for now, so all we need to really do is find a job that needs processing and get the information. How would we do this? Well pick our job selection criteria and look for jobs, in SQL I did the following:

  1. Take any jobs that are not marked as complete but from our worker and reset them (substitute __ME__ with an identifier, easiest would be IP address):
     UPDATE `jobs` SET `status` = 0 WHERE `status` = 1 AND `started_by` = __ME__; 
  2. Using our job selection criteria, select a job and tell the control system that this worker is dealing with it:
     UPDATE `jobs` SET `status` = 1, `started_by` = __ME__, `started_at` = NOW() WHERE `status` = 0 OR
    (`status` = 1 AND `started_at` > DATE_SUB(NOW(), INTERVAL X HOUR)) ORDER BY `id` ASC; 

    By grabbing jobs that haven't returned results in X amount of time we ensure that all jobs are run in the event of a worker crashing or going AWOL.

  3. Next grab the jobs details followed by the records themselves:
     SELECT * FROM `jobs` WHERE `started_by` = __ME__ LIMIT 1;
    SELECT * FROM `job_records` WHERE `id` = __JOBID__; 

Upon completion of the job we insert our result records and mark the job as complete. Remember as jobs can suspend/resume at any time allow for some robustness in your script. It might be that the task suspends half way through updating the job control system, so checking the number of records in a job and the number of results saved back to the job control system would be a wise move.

In addition, whilst this demonstrates how jobs can be selected and managed from an SQL-query frame you should really be abstracting your job control so that if you decide to switch to using a web service, a file based system, XML , or any other number of systems it will not affect the code above it.

Job Configuration

The next aspect to consider is job size and configuration. By playing with job configuration we can strike an excellent balance between speed, process replication, and reliability. Take a couple of scenarios:

  1. Jobs take 1 day each to run: This means that your workers need 15 days to process each job (remember 10% of the power for 2/3rds of the time). This is clearly not a wise configuration, your job size is way too big! It would take at least double the time to get a job processed should the initial worker go AWOL (time to pick up that it hasn't returned a result plus reprocessing time). In an ideal you'd have at least one full job easily cleared by the end of each long idle period, that way you keep the jobs ticking over and at worst case a job would take two days to process should the first go missing.
  2. Jobs take 1 minute to run: This means that your workers take about 15 minutes to run each job. Whilst this may initially seem ideal, you gain additional work processing during lunch time, coffee breaks, meetings, etc this scenario puts strain on other areas of your system and introduces its own problems. For example, firstly your setup/processing time ratio is going to go right down, therefore losing system efficiency. Your network is going to be constantly streaming job information to the various workers frustrating staff who are dong their day to day work. You're also going to put more strain on your job processing server as it has to dish out lots and lots of small pieces of work on a regular basis. Lastly, in this situation if your job server goes down you're going to create a huge back log of uncompleted work whereas bigger jobs could of continued processing blissfully unaware that the job server was experiencing difficulties.

In reality there will be no one ideal configuration for your grid setup, much depends on the available resources, types of job, job turnaround time requirements, network capability, and so on. However some guidelines would be:

  • Size jobs so that each worker can get through at least 3-4 jobs in a period of 15 hours (the longest likely idle time period)
  • Play with the job size so that setup time becomes fairly insignificant compared to the processing time (bearing in mind the above point).
  • If a job doesn't complete in double the amount of time (maybe less) you expect it to complete it assume that its gone AWOL and start processing it with another worker. This means you may have to wait up to three times the normal length of a job for it to complete (possibly longer if the subsequent job fails). You may want to reduce this time, but be careful not to reduce it too much as you may start duplicating processing tasks on a regular basis.
  • Jobs should be independent of outside requirements as much as possible. The job server, for example, should only be contacted at the start and end of every job.
  • Don't saturate your network, this will have two negative effects, your daytime staff will find using the network frustrating and problems may be experienced with connections timing out a problem that will only get worse as you scale your grid.
  • Ensure jobs can run on your workers. If jobs become too memory intensive or disk space intensive jobs will start aborting and the only thing you'll notice is a drop in number of jobs processed with no real reason why.

Submitting Results of a Job

When submitting the results of a job it is important to check that results have not been submitted by another worker, especially if the current worker has been dormant for some time.

When results are submitted ensure that the number of results matches the number of records within the job.

As stated previously, and can not be over emphasised, build fault tolerance into job retrieval and results submission. The workers can (and most likely will) go into suspend mode at the most inconvenient of times and this needs to be catered for. Also once again abstracting away your results submission will help cater for future changes to your job control system much easier to deal with.

सारांश

In this section we have looked at what a job control server needs to do and how to get a very basic system set up. We discussed how to retrieve a job from the control system and how best to configure jobs to get the most our of your office grid system. To finish, a paragraph or two on submitting results back to the job control server was presented.

  • A job control server manages jobs and ensures that all work units are completed
  • By abstracting your job select/results submission we can change the technology of the control server without much problems
  • Configure your jobs to ensure that they are run quickly and efficiently without putting too much pressure on your network infrastructure, and without duplicating processing tasks on a regular basis.
  • Ensure that you build fault tolerance and error checking into your routines, workers can suspend and resume and the most inconvenient of times. Remember to check if results have already been submitted by another worker.

Next time

In part 3 we'll create our virtual processing machine and set up our windows machines to become idle-time workers.

Office Grid Computing using Virtual environments – Part 5

By , Friday 4th December 2009 11:03 pm

परिचय

I work in a company where we run many batch jobs processing millions of records of data each day and I've been thinking recently about all the machines that sit around each and every day doing nothing for several hours. Wouldn't it be good if we could use those machines to bolster the processing power of our systems? In this set of articles I'm going to look at the potential benefits of employing an office grid using virtualised environments.

In Part 4 we looked at using tools to ensure that we're running the latest version of the code and data sources so that obtained results are always up-to-date with the latest business information and logic.

Pre-Deployment

Before deploying your grid system if there's one thing you do and one thing alone it's benchmark your current system ! No matter what you tell colleagues about how much extra work your system is going to do unless you have numbers to back this up your guarantees are nothing. So,

  • how many records can you process currently? Per Day? Per Hour?
  • How long does it typically take to turn around a job?
  • How much more capacity do you have?

There's also additional questions:

  • If your processing server (or one of your processing servers) goes down how will this affect your capabilities, will you be crippled?
  • What advantages do you hope/expect to get from a grid system?
  • Are your office machines capable of running the jobs?
  • Are your (or can you jobs be converted) to wrok in this style of running?

The last major point is to take your time on any major change like this. Update your processing code to work using the new methodology, benchmark again. Possibly set up your processing server to run a virtual machine, after all your processing server will just be another worker (just a very powerful one relatively). Allow the new process to settle.

Deployment

My suggestion would be to pop into the office one weekend perform all the installations and setup. Do this just before a fortnight's holiday and leave so other poor chap to deal with the consequences… maybe not…

Deployment for a system like this needs to be slow. Despite it being relatively simple to set up this system will affect your entire office infrastructure (well the digital one). Firstly, roll out to a couple of machines at a time, monitor network traffic, how the worker hosts perform on a day-to-day basis. You may need to alter your job configuration in response to your findings.

Once the system has settled with a few machines (lets say 10% of all office machines, ie 5) keep monitoring network traffic and host machine performance. Next benchmark again, you should now be processing 33% more jobs than your first benchmarks. Check this is so, or that you're at least in this ballpark. If not, investigate what is going on before moving on. Repeat this cycle until you happily have all office machines running without killing individual machine performance or grinding your network to a standstill.

At all times keep benchmarking, even after all deployments are made. Check how new code updates affect speed of your system, check all workers are reporting in and processing jobs. Slowly (very slowly) increment your job configuration to get the best from your workers and network.

बंद करो!

What if you want to stop your workers from running at some time? They are all out there running, regenerating, and trying their best to process data like hungry insects. The answer may seem obvious but its worth adding just in case its overlooked. Simply edit your processing script with an exit(0) or die() or some other statement to kill your processing job. An important reason why we always try to update to the latest processing script before any run!

Demonstration System

In order to write this set of short articles I created a very small grid to demonstrate the technologies and methodologies. I read lots of articles, tutorials, and used various tools to setup and monitor what was going on. By no means have I gone out and saturated a whole office with traffic and nor have I had access to a regular staff members PC to see how host performance was affected.

My demonstration system was very humble indeed. I used my regular desktop set up as a job control server. On this I had installed mySQL server installed set up as a master in replication, PHP , and SVN linked through apache (for access via worker VM).

I then created a centOS worker machine on VirtualBox on a 6 year old windows XP laptop. I setup scheduled tasks as specified after copying the VM onto the machine and let it go.

The virtual machine was set up with PHP, subversion, and mySQL. I checked out a branch named 'worker' from my job control servers repository and made sure it could be updated using 'svn update'. Next I setup mySQL as a slave and checked that data was replicating from mySQL on the job control server down to the worker VM. After all this I setup the bash script and the cron job.

My processing script basically went along the lines of this (very simple stuff):

  • Read in the name field
  • Counted the number of similar names in a table from the data source held on the VM
  • Counted the number of names as above but splitting the name by spaces (ie forename, middle, surname)
  • Repeated this process 1,000 times

Each job took approximately 20 minutes to run. At one point I opened several copies of the worker VM on the windows laptop and watched the jobs be checked off by each of the worker IP addresses. At this point I also confirmed that replication automatically restarted.

Leaving the laptop to idle resulted in a worker starting to process jobs from the job control server. When resuming laptop usage there was a delay of about 30-60 seconds, this is a fair amount of time and staff would need to be made aware that their machine may pause for a short while when returning to the machine. Newer machines may not have a pause of this long. The benefit of the amount of processing performed by these machines during idle periods would more that outweigh staff members having to wait a short period (say 1 minute) on arriving at their machines of a morning (I frequently wait longer that this for a Windows Defender update to take place) provided they were made aware of this (useful time to grab a morning coffee!).

Overall I feel confident that I have demonstrated the technologies that could be used to create such a system. I have shown that such a system does work on a (very) small scale and with some more experimenting could be scaled up utilise the resources of an office's machines. If I don't get to the point of doing this I would be very interested to know/see when someone else does.

Conclusions / Evaluation

The next obvious step would be to actually get a real world example and start to deploy a system such as this within an office environment and see what happens. Asking a business to commit to this without a trail blazing company to prove the technology and effectiveness may be a little difficult. Grid/Distributed computing is very popular is some circles and has some large applications (BIONC, SETI@Home, Folding@Home, etc). I did not, however, find a smaller scale and simple system like this in my searches that could be rolled out within an office environment.

I created a basically free system using mostly open source software and tools available in almost any office. The technologies were basically demonstrated and show to perform and work as expected. Hopefully I have show that with not much work and with a very simple setup you can deploy an office grid computing system that is powerful, cheap, and scalable all at the same time.

Once a system is up and running there is almost no end to the amount of customisation and improvements you can make. For example statistics / benchmarking can easily be added showing the worth of such a system every day. New machines can be added quickly and easily as and when they arrive with upgrades to existing hardware bolstering your processing power.

I hope you've enjoyed reading this series of articles and its given you food for thought on running an office grid system. The solution presented here won't necessarily work in all situations but should be adaptable to allow you to get your data processing done using your own solution.

Please feel free to send me any comments, corrections, or improvements and I'll do my best to keep this article updated to match.













Panorama Theme by Themocracy

4 visitors online now
2 guests, 2 bots, 0 members
Max visitors today: 11 at 01:15 am UTC
This month: 40 at 23-05-2012 03:33 am UTC
This year: 69 at 27-02-2012 09:56 am UTC
All time: 130 at 28-03-2011 10:40 pm UTC