Rrdtool الحركة من المتوسط


أنا أعمل مع كمية كبيرة من السلاسل الزمنية. وهذه المسلسلات الزمنية هي أساسا قياسات الشبكة قادمة كل 10 دقائق، وبعضها دوري (أي عرض النطاق الترددي)، في حين أن بعض المداخل الأخرى (أي مقدار حركة التوجيه). أود خوارزمية بسيطة للقيام الكشف خارج الإنترنت. في الأساس، أريد أن أبقى في الذاكرة (أو على القرص) البيانات التاريخية كلها لكل سلسلة زمنية، وأريد أن الكشف عن أي خارج في سيناريو الحية (في كل مرة يتم التقاط عينة جديدة). ما هي أفضل طريقة لتحقيق هذه النتائج إم حاليا باستخدام المتوسط ​​المتحرك من أجل إزالة بعض الضوضاء، ولكن بعد ذلك ما بعد الأشياء البسيطة مثل الانحراف المعياري، جنون. ضد مجموعة البيانات كلها لا تعمل بشكل جيد (لا أستطيع أن نفترض أن سلسلة زمنية ثابتة)، وأود أن شيئا أكثر دقة، من الناحية المثالية مربع أسود مثل: ضعف أوتليرديتكتيون (ناقلات مزدوجة، قيمة مزدوجة) حيث ناقلات هو مجموعة من تحتوي على مزدوجة والبيانات التاريخية، وقيمة الإرجاع هي النتيجة الشاذة لقيمة العينة الجديدة. طلب أغسطس 2 10 في 20:37 نعم، لقد افترضت تردد معروف ومحدد. هناك طرق لتقدير التردد تلقائيا، ولكن من شأنها أن تعقد وظيفة إلى حد كبير. إذا كنت بحاجة لتقدير التردد، حاول طرح سؤال منفصل حول ذلك - و I39ll ربما تقديم إجابة ولكن يحتاج مساحة أكبر مما أتيحت في تعليق. نداش روب هيندمان أوج 3 10 في 23:40 وهناك حل جيد لديها العديد من المكونات، بما في ذلك: استخدام مقاومة، والانتقال نافذة على نحو سلس لإزالة نونستاتيوناريتي. إعادة التعبير عن البيانات الأصلية بحيث البقايا فيما يتعلق بسلاسة وتوزيعها بشكل متناظر تقريبا. نظرا لطبيعة البيانات الخاصة بك، من المرجح أن جذورها مربع أو اللوغاريتمات تعطي مخلفات متماثلة. تطبيق أساليب التحكم في الرسم البياني، أو على الأقل مراقبة تخطيط التفكير، إلى بقايا. بقدر ما يذهب آخر واحد، ويظهر الرسم البياني مراقبة الرسم البياني أن العتبات التقليدية مثل 2 سد أو 1.5 أضعاف إقر وراء الربعين تعمل بشكل سيء لأنها تؤدي الكثير من إشارات كاذبة خارج عن السيطرة. الناس عادة استخدام 3 سد في العمل الرسم البياني السيطرة، من حيث 2.5 (أو حتى 3) مرات إقر وراء الرباعي سيكون نقطة انطلاق جيدة. لقد أوضحت بشكل أو بآخر طبيعة حل روب هيندمانز في حين أضفت إليها نقطتين رئيسيتين: الحاجة المحتملة إلى إعادة التعبير عن البيانات والحكمة من كونها أكثر تحفظا في الإشارة إلى أن من الخارج. أنا لست متأكدا من أن لوس هو جيد للكشف عن الانترنت، على الرغم من ذلك لأنه لا يعمل بشكل جيد في النهاية. يمكنك بدلا من ذلك استخدام شيء بسيط مثل مرشح الوسيط المتحرك (كما هو الحال في توكيس مقاومة التمهيد). إذا لم تأتي القيم المتطرفة في رشقات نارية، يمكنك استخدام نافذة ضيقة (5 نقاط البيانات، ربما، والتي سوف تنهار فقط مع انفجار من 3 أو أكثر القيم المتطرفة ضمن مجموعة من 5). مرة واحدة كنت قد أجريت التحليل لتحديد جيد إعادة التعبير عن البيانات، من غير المرجح أن تحتاج إلى تغيير إعادة التعبير. لذلك، كاشف الانترنت الخاص بك حقا يحتاج فقط إلى الرجوع إلى أحدث القيم (أحدث نافذة) لأنه لن تستخدم البيانات السابقة على الإطلاق. إذا كان لديك سلسلة زمنية طويلة حقا يمكن أن تذهب أبعد من ذلك لتحليل الارتباط الذاتي والموسمية (مثل التقلبات اليومية أو الأسبوعية المتكررة) لتحسين الإجراء. أجاب 26 أغسطس 10 في 18:02 جون، 1.5 إقر هو Tukey39s التوصية الأصلية لأطول شعيرات على بوكسبلوت و 3 إقر هو توصيته لنقاط بمناسبة كما كوتار أوتيرلزكوت (حثالة على عبارة 6039s شعبية). هذا هو في صلب العديد من خوارزميات بوكسبلوت. تم تحليل التوصية نظريا في هواجلين، موستيلر، أمب توكي، فهم تحليل البيانات القوية والاستكشافية. نداش w هيوبر 9830 أوكت 9 12 في 21:38 هذا يؤكد البيانات سلسلة زمنية كنت أحاول تحليل. متوسط ​​النافذة وأيضا انحرافات نافذة قياسية. ((x - أفغ) سد) غ 3 يبدو أن النقاط التي أريد أن أعلم كما المتطرفين. حسنا على الأقل تحذير كما أوتلييرز، وأنا أعلم أي شيء أعلى من 10 سد كما المتطرفين الخطأ المتطرفة. المشكلة التي واجهت هو ما هو مثالي طول نافذة I39m اللعب مع أي شيء بين 4-8 نقاط البيانات. نداش نيوزينيث 29 يونيو 16 في 08:00 الجدد قد يكون أفضل رهان لتجربة مع مجموعة فرعية من البيانات الخاصة بك وتأكيد استنتاجاتك مع اختبارات على ما تبقى. يمكنك إجراء عملية التحقق من صحة أكثر رسمية، أيضا (ولكن هناك حاجة إلى رعاية خاصة مع البيانات سلسلة زمنية بسبب الترابط بين جميع القيم). نداش w هوبر 9830 جون 29 16 في 12:10 (ردت هذه الإجابة على سؤال مكررة (مغلق الآن) في الكشف عن الأحداث المعلقة التي قدمت بعض البيانات في شكل رسوم بيانية). الكشف الخارجي يعتمد على طبيعة البيانات وعلى ما على استعداد لتحمل عنها. وتعتمد الطرق العامة الغرض على إحصاءات قوية. روح هذا النهج هو وصف الجزء الأكبر من البيانات بطريقة لا تتأثر أي القيم المتطرفة ومن ثم نشير إلى أي القيم الفردية التي لا تناسب هذا التوصيف. لأن هذا هو سلسلة زمنية، فإنه يضيف تعقيد الحاجة إلى (إعادة) الكشف عن القيم المتطرفة على أساس مستمر. إذا كان هذا هو أن يتم ذلك كما تتكشف سلسلة، ثم يسمح لنا فقط لاستخدام البيانات القديمة للكشف، وليس البيانات في المستقبل وعلاوة على ذلك، كحماية ضد العديد من الاختبارات المتكررة، ونحن نريد أن استخدام أسلوب يحتوي على كاذبة منخفضة جدا إيجابي. هذه الاعتبارات تشير إلى تشغيل بسيطة، قوية تتحرك نافذة اختبار خارجي على البيانات. هناك العديد من الاحتمالات، ولكن واحدة بسيطة، من السهل فهمها وسهولة تنفيذها واحد يقوم على تشغيل ماد: متوسط ​​الانحراف المطلق عن الوسيط. ويعد هذا مقياسا قويا قويا للتغير داخل البيانات، وهو ما يشبه الانحراف المعياري. وستكون الذروة البعيدة عدة مدارات أو أكثر من المتوسط. لا يزال هناك بعض الضبط الذي يتعين القيام به. كم من الانحراف عن الجزء الأكبر من البيانات ينبغي أن تعتبر نائية، وإلى أي مدى مرة أخرى في الوقت المناسب ينبغي أن ننظر واحد يتيح ترك هذه كمعلمات للتجريب. تطبيق هيريس R على البيانات x (1،2، لدوتس، n) (مع n1150 لمحاكاة البيانات) مع القيم المقابلة y: تطبق على مجموعة البيانات مثل المنحنى الأحمر موضح في السؤال، وتنتج هذه النتيجة: البيانات مبينة باللون الأحمر، ونافذة 30 يوما من العتبات الوسطية 5 رمادية، والقيم المتطرفة - التي هي ببساطة تلك القيم للبيانات فوق المنحنى الرمادي - باللون الأسود. (لا يمكن حساب العتبة إلا في نهاية النافذة الأولية، وبالنسبة لجميع البيانات الموجودة في هذه النافذة الأولية، تستخدم العتبة الأولى: هذا هو السبب في أن المنحنى الرمادي مسطح بين x0 و x30.) إن آثار تغيير المعلمات هي (أ) زيادة قيمة النافذة سوف تميل إلى تمهيد المنحنى الرمادي و (ب) زيادة عتبة رفع المنحنى الرمادي. ومع ذلك، يمكن للمرء أن يأخذ شريحة أولية من البيانات وتحديد بسرعة المعلمات من المعلمات التي تفصل أفضل القمم البعيدة من بقية البيانات. تطبيق قيم المعلمات هذه للتحقق من بقية البيانات. إذا أظهرت المؤامرة الطريقة تزداد سوءا مع مرور الوقت، وهذا يعني أن طبيعة البيانات تتغير وقد تحتاج المعلمات إلى إعادة ضبط. لاحظ كيف القليل هذا الأسلوب يفترض حول البيانات: أنها لا تحتاج إلى أن توزع عادة أنها لا تحتاج إلى عرض أي دورية أنها لا تحتاج حتى أن تكون غير سلبية. كل ما يفترض هو أن البيانات تتصرف بطريقة مماثلة إلى حد كبير على مر الزمن وأن القمم النائية هي أعلى بشكل واضح من بقية البيانات. إذا كان أي شخص يرغب في تجربة (أو مقارنة بعض الحلول الأخرى إلى واحد عرضت هنا)، وهنا هو رمز كنت تستخدم لإنتاج البيانات مثل تلك المعروضة في السؤال. أنا التخمين متطورة نموذج سلسلة الوقت لن تعمل بالنسبة لك بسبب الوقت الذي يستغرقه للكشف عن القيم المتطرفة باستخدام هذه المنهجية. لذلك، هنا هو الحل: أولا إنشاء خط الأساس أنماط المرور العادية لمدة سنة على أساس التحليل اليدوي للبيانات التاريخية التي تمثل الوقت من اليوم، أيام الأسبوع مقابل عطلة نهاية الأسبوع، شهر من السنة الخ استخدام هذا خط الأساس جنبا إلى جنب مع بعض آلية بسيطة (مثل المتوسط ​​المتحرك الذي اقترحه كارلوس) للكشف عن القيم المتطرفة. قد ترغب أيضا في مراجعة الأدب الإحصائي لمراقبة العملية لبعض الأفكار. نعم، هذا هو بالضبط ما أقوم به: حتى الآن أنا يدويا تقسيم إشارة إلى فترات، بحيث لكل واحد منهم يمكن أن تحدد فترة الثقة التي من المفترض أن تكون إشارة ثابتة، وبالتالي يمكنني استخدام أساليب قياسية مثل كما الانحراف المعياري. المشكلة الحقيقية هي أنني لا يمكن أن تقرر النمط المتوقع لجميع الإشارات يجب أن تحليل، وهذا 39s لماذا I39m تبحث عن شيء أكثر ذكاء. نداش جانلوكا 2 أغسطس 10 في 21:37 هنا هو فكرة واحدة: الخطوة 1: تنفيذ وتقدير نموذج سلسلة زمنية عامة على أساس مرة واحدة استنادا إلى البيانات التاريخية. ويمكن القيام بذلك حاليا. الخطوة 2: استخدام النموذج الناتج للكشف عن القيم المتطرفة. الخطوة 3: في بعض الترددات (ربما كل شهر)، إعادة معايرة نموذج السلاسل الزمنية (وهذا يمكن القيام به حاليا) بحيث كشف الخطوة 2 من القيم المتطرفة لا يذهب كثيرا من خطوة مع أنماط حركة المرور الحالية. هل هذا العمل لسياقك نداش user28 2 أغسطس 10 في 22:24 نعم، قد يعمل هذا. كنت أفكر في نهج مماثل (إعادة حساب خط الأساس كل أسبوع، والتي يمكن أن تكون وحدة المعالجة المركزية مكثفة إذا كان لديك مئات من المتسلسلة الزمنية أحادية المتغيرات لتحليل). راجع للشغل السؤال الصعب الحقيقي هو كووات هو أفضل خوارزمية على غرار الاسود على غرار النمذجة إشارة عامة تماما، النظر في الضوضاء، وتقدير الاتجاه والموسمية. عفيك، كل نهج في الأدب يتطلب مرحلة صعبة حقا تونينكوت كوتاراميتر، والطريقة الوحيدة التي وجدت التلقائي هو نموذج أريما من قبل هيندمان (روجيندمانزوفتوفوريكاست). أنا في عداد المفقودين شيء نداش جانلوكا 2 أغسطس 10 في 22:38 مرة أخرى، وهذا يعمل بشكل جيد إذا كان من المفترض أن يكون إشارة موسمية من هذا القبيل، ولكن إذا كنت تستخدم سلسلة زمنية مختلفة تماما (أي متوسط ​​تكب ذهابا وإيابا الوقت مع مرور الوقت )، لن تعمل هذه الطريقة (لأنه سيكون من الأفضل التعامل مع ذلك مع المتوسط ​​العالمي البسيط والانحراف المعياري باستخدام نافذة منزلقة تحتوي على بيانات تاريخية). نداش جانلوكا 2 أغسطس 10 في 22:02 إلا إذا كنت على استعداد لتنفيذ نموذج سلسلة الوقت العام (الذي يجلب في سلبياتها من حيث الكمون الخ) أنا متشائم أنك سوف تجد التنفيذ العام الذي في نفس الوقت هو بسيط بما فيه الكفاية للعمل لجميع أنواع السلاسل الزمنية. نداش user28 أوج 2 10 في 22:06 تعليق آخر: أنا أعرف أن إجابة جيدة قد يكون أيضا يمكنك تقدير دورية للإشارة، وتقرر الخوارزمية لاستخدامها وفقا ل إيتكوت، ولكن أنا didn39t العثور على حل جيد حقيقي لهذا الآخر (لعبت قليلا مع التحليل الطيفي باستخدام دفت وتحليل الوقت باستخدام وظيفة الارتباط الذاتي، ولكن بلدي سلسلة زمنية تحتوي على الكثير من الضوضاء وهذه الأساليب تعطي بعض النتائج مجنون معظم الوقت) نداش جانلوكا 2 أغسطس 10 في 22:06 A التعليق على التعليق الأخير الخاص بك: that39s لماذا I39m تبحث عن نهج أكثر عمومية، ولكن أنا بحاجة إلى نوع من بوكبلاك كوتكوت لأنني يمكن 39t جعل أي افتراض حول إشارة تحليلها، وبالتالي أنا يمكن 39t إنشاء مجموعة معلمات كوبيست لخوارزمية التعلم. نداش جانلوكا 2 أغسطس 10 في 22:09 لأنه هو سلسلة البيانات الزمنية، مرشح الأسي بسيط en. wikipedia. orgwikiEononsmsmoothing سوف تبسيط البيانات. وهو مرشح جيد جدا منذ كنت لا تحتاج إلى تجميع نقاط البيانات القديمة. مقارنة كل قيمة البيانات تمهيد حديثا مع قيمة أونسموثيد لها. مرة واحدة يتجاوز الانحراف عتبة محددة مسبقا محددة (اعتمادا على ما كنت تعتقد أن أوتلير في البيانات الخاصة بك هو)، ثم الخاص بك خارج يمكن الكشف بسهولة. أجاب 30 أبر 15 في 8:50 هل يمكن استخدام الانحراف المعياري للقياسات N الماضية (لديك لاختيار N مناسبة). وتكون النتيجة الشاذة الجيدة هي عدد الانحرافات المعيارية التي يتم قياسها من المتوسط ​​المتحرك. أجاب 2 أغسطس في 20:48 شكرا لكم على ردكم، ولكن ماذا لو كانت إشارة يحمل موسمية عالية (أي الكثير من القياسات شبكة تتميز بنمط يومي وأسبوعي في نفس الوقت، على سبيل المثال ليلة مقابل يوم أو عطلة نهاية الأسبوع مقابل أيام العمل) لن يعمل نهج قائم على الانحراف المعياري في هذه الحالة. نداش جانلوكا 2 أغسطس 10 في 20:57 على سبيل المثال، إذا حصلت على عينة جديدة كل 10 دقيقة، و I39m القيام كشف خارج النطاق من استخدام النطاق الترددي للشبكة من الشركة، وأساسا في 06:00 هذا التدبير سوف تسقط (وهذا هو المتوقع نمط عادي تماما)، وسوف يفشل الانحراف المعياري محسوبة على نافذة انزلاق (لأنه سيؤدي إلى تنبيه على وجه اليقين). في الوقت نفسه، إذا انخفض التدبير في 4:00 (الانحراف عن خط الأساس المعتاد)، وهذا هو أوتلير الحقيقي. نداش جانلوكا 2 أغسطس 10 في 20:58 ما أقوم به هو مجموعة القياسات حسب الساعة واليوم من الأسبوع ومقارنة الانحرافات القياسية من ذلك. لا يزال لا تصحيح لأشياء مثل العطلات والموسمية الصيفية ولكن الصحيح معظم الوقت. الجانب السلبي هو أنك حقا بحاجة لجمع سنة أو نحو ذلك من البيانات لديك ما يكفي بحيث ستديف يبدأ المنطق. ويكتشف التحليل الطيفي التواتر الدوري في السلاسل الزمنية الثابتة. نهج النطاق الترددي القائم على تقدير الكثافة الطيفية هو النهج الذي أوصي به كخطوة أولى. إذا كان عدم انتظام فترات معينة يعني ذروة أعلى بكثير مما هو نموذجي لتلك الفترة، فإن السلسلة مع مثل هذه المخالفات لن تكون ثابتة وأن الانزياح الطيفي لن يكون مناسبا. ولكن على افتراض أنك قد حددت الفترة التي لديها مخالفات يجب أن تكون قادرة على تحديد ما يقرب من ارتفاع الذروة العادية سيكون ثم يمكن تعيين عتبة على مستوى ما فوق هذا المتوسط ​​لتعيين الحالات غير النظامية. أجاب سيب 3 12 في 14:59 أقترح المخطط أدناه، والتي ينبغي أن تكون قابلة للتطبيق في يوم أو نحو ذلك: جمع العديد من العينات كما يمكنك الاحتفاظ في الذاكرة إزالة القيم المتطرفة واضحة باستخدام الانحراف المعياري لكل سمة حساب وتخزين مصفوفة الارتباط وكذلك متوسط ​​كل سمة حساب وتخزين المسافات محالانوبيس من كل ما تبذلونه من العينات حساب البذلة: لعينة واحدة التي تريد أن تعرف لها البخاري: استرداد الوسائل، مصفوفة التباين و ماهالانوبيس المسافة ق من التدريب حساب المسافة ماهالانوبيس د لعينتك إرجاع النسبة المئوية التي d يسقط (باستخدام مسافات ماهالانوبيس من التدريب) التي ستكون النتيجة أوتلير الخاص بك: 100 هو خارج المتطرفة المتطرفة. PS. في حساب المسافة ماهالانوبيس. استخدام مصفوفة الارتباط، وليس مصفوفة التباين المشترك. هذا هو أكثر قوة إذا كانت قياسات العينة تختلف في وحدة ورقم. غرافيت 1 يؤدي مهمتين بسيط جدا: تخزين الأرقام التي تتغير مع مرور الوقت والرسوم البيانية لهم. كان هناك الكثير من البرامج المكتوبة على مر السنين للقيام بهذه المهام نفسها. ما يجعل الفريد الجرافيت هو أنه يوفر هذه الوظيفة كخدمة الشبكة التي هي على حد سواء سهلة الاستخدام وقابلة للتطوير للغاية. بروتوكول لتغذية البيانات في الجرافيت هو بسيط بما فيه الكفاية التي يمكن أن تتعلم أن تفعل ذلك باليد في بضع دقائق (لا أن يود تريد في الواقع، ولكن لها اختبار ليتموس لائق للبساطة). يعد عرض الرسوم البيانية واسترجاع نقاط البيانات أمرا سهلا مثل جلب عنوان ورل. وهذا يجعل من الطبيعي جدا لدمج الجرافيت مع البرامج الأخرى وتمكن المستخدمين من بناء تطبيقات قوية على رأس الجرافيت. واحدة من الاستخدامات الأكثر شيوعا من الجرافيت هو بناء لوحات على شبكة الإنترنت لرصد وتحليل. ولد الجرافيت في بيئة التجارة الإلكترونية عالية الحجم وتصميمه يعكس هذا. إن إمكانية الوصول إلى البيانات في الوقت الحقيقي هي أهداف رئيسية. المكونات التي تسمح الجرافيت لتحقيق هذه الأهداف تشمل مكتبة قاعدة بيانات متخصصة وتنسيق التخزين، وآلية التخزين المؤقت لتحسين عمليات إو، وطريقة بسيطة لكنها فعالة لتجميع خوادم الجرافيت. بدلا من مجرد وصف كيف يعمل الجرافيت اليوم، وسوف أشرح كيف تم تنفيذ الجرافيت في البداية (ساذجة تماما)، ما المشاكل التي واجهت، وكيف وضعت الحلول لهم. 7.1. مكتبة قاعدة البيانات: تخزين الوقت سلسلة البيانات مكتوبة الجرافيت تماما في بايثون ويتألف من ثلاثة مكونات رئيسية هي: مكتبة قاعدة بيانات اسمه الهمس. خفي الخلفية اسمه الكربون. و ويباب الأمامية التي تجعل الرسوم البيانية ويوفر واجهة المستخدم الأساسية. في حين تم كتابة الهمس خصيصا للجرافيت، ويمكن أيضا أن تستخدم بشكل مستقل. وهو مشابه جدا في التصميم لقاعدة بيانات روبن روبن المستخدمة من قبل ردتول، ويخزن فقط البيانات الرقمية سلسلة زمنية. عادة ما نفكر في قواعد البيانات كعمليات الخادم التي تتحدث تطبيقات العميل إلى أكثر من مآخذ. ومع ذلك، الهمس. مثل ردتول، هي مكتبة قاعدة بيانات تستخدمها التطبيقات للتلاعب واسترجاع البيانات المخزنة في ملفات منسقة خصيصا. عمليات الهمس الأساسية هي خلق لجعل ملف الهمس الجديد، تحديث لكتابة نقاط بيانات جديدة في ملف، وجلب لاسترداد نقاط البيانات. الشكل 7.1: التشريح الأساسي لملف الهمس كما هو مبين في الشكل 7.1. تتكون ملفات الهمس من قسم رأس يحتوي على بيانات وصفية مختلفة، يليها قسم أرشيف واحد أو أكثر. كل أرشيف هو سلسلة من نقاط البيانات المتتالية التي هي (الطابع الزمني، قيمة) أزواج. عند تنفيذ عملية تحديث أو جلب، يحدد الهمس الإزاحة في الملف حيث يجب كتابة البيانات إلى أو قراءتها، استنادا إلى الطابع الزمني وتكوين الأرشيف. 7.2. النهاية الخلفية: خدمة التخزين بسيطة الجرافيت نهاية النهاية هي عملية الخفي يسمى الكربون مخبأ. وعادة ما يشار إليها ببساطة باسم الكربون. وهو مبني على الملتوية، إطار إو يحركها الحدث عالية التحرك لبيثون. الملتوية تمكن الكربون على التحدث بكفاءة مع عدد كبير من العملاء والتعامل مع كمية كبيرة من حركة المرور مع النفقات العامة المنخفضة. ويبين الشكل 7.2 تدفق البيانات بين الكربون. الهمس و ويباب: تطبيقات العميل جمع البيانات وإرسالها إلى نهاية الجرافيت، الكربون. الذي يخزن البيانات باستخدام الهمس. ويمكن بعد ذلك أن تستخدم هذه البيانات من قبل ويباب الجرافيت لتوليد الرسوم البيانية. الشكل 7-2: تدفق البيانات تتمثل الوظيفة الأساسية للكربون في تخزين نقاط البيانات للمقاييس التي يقدمها العملاء. في المصطلحات الجرافيتية، المقياس هو أي كمية قابلة للقياس التي يمكن أن تختلف مع مرور الوقت (مثل استخدام وحدة المعالجة المركزية للخادم أو عدد من مبيعات المنتج). نقطة البيانات هي ببساطة (خاتم الوقت، القيمة) الزوج المقابلة للقيمة المقاسة لمقياس معين في نقطة زمنية. يتم تحديد المقاييس بشكل فريد باسمها، ويتم تقديم اسم كل مقياس بالإضافة إلى نقاط البيانات من خلال تطبيقات العميل. وهناك نوع شائع من تطبيقات العميل هو عامل المراقبة الذي يجمع مقاييس النظام أو التطبيق، ويرسل قيمه المجمعة إلى الكربون لسهولة التخزين والتصور. المقاييس في الجرافيت لها أسماء هرمية بسيطة، مماثلة لمسارات نظام الملفات إلا أن يتم استخدام نقطة لتحديد التسلسل الهرمي بدلا من شرطة مائلة أو مائلة للخلف. سوف يحترم الكربون أي اسم قانوني ويخلق ملف الهمس لكل مقياس لتخزين نقاط البيانات الخاصة به. يتم تخزين ملفات الهمس داخل دليل بيانات الكربون في التسلسل الهرمي لنظام الملفات الذي يعكس التسلسل الهرمي لنقاط محددة في كل اسم مقاييس، بحيث (على سبيل المثال) خوادم. www. cpuUsage الخرائط إلى hellipserverswww01cpuUsage. wsp. عندما يرغب تطبيق عميل لإرسال نقاط البيانات إلى الجرافيت يجب إنشاء اتصال تكب إلى الكربون. عادة على ميناء 2003 2. العميل لا كل الكربون الحديث لا يرسل أي شيء على اتصال. يرسل العميل نقاط البيانات بتنسيق نص عادي بسيط بينما قد يتم ترك الاتصال مفتوحا وإعادة استخدامه حسب الحاجة. الشكل هو سطر واحد من النص لكل نقطة بيانات حيث يحتوي كل سطر على اسم المقياس المنقط والقيمة والطابع الزمني لعصر أونيكس مفصول بمسافات. على سبيل المثال، قد يرسل عميل: على مستوى عال، كل الكربون يفعل هو الاستماع للبيانات في هذا الشكل ومحاولة تخزينه على القرص في أسرع وقت ممكن باستخدام الهمس. في وقت لاحق سوف نناقش تفاصيل بعض الحيل المستخدمة لضمان قابلية والحصول على أفضل أداء يمكننا الخروج من القرص الصلب النموذجي. 7.3. الواجهة الأمامية: الرسوم البيانية حسب الطلب يتيح تطبيق ويب غرافيت للمستخدمين طلب رسوم بيانية مخصصة باستخدام واجهة برمجة تطبيقات بسيطة تستند إلى عناوين ورل. يتم تحديد معلمات الرسوم البيانية في سلسلة الاستعلام لطلب هتب جيت، ويتم عرض صورة ينغ استجابة. على سبيل المثال، عنوان ورل: يطلب رسم بياني 500times300 لخوادم المقاييس. www.01.cpuUsage وعلى مدار 24 ساعة من البيانات. في الواقع، مطلوب فقط المعلمة الهدف جميع الآخرين اختيارية واستخدام القيم الافتراضية الخاصة بك إذا حذفت. الجرافيت يدعم مجموعة واسعة من خيارات العرض وكذلك وظائف التلاعب البيانات التي تتبع بناء جملة وظيفية بسيطة. على سبيل المثال، يمكننا رسم متوسط ​​متحرك من 10 نقاط للمقياس في مثالنا السابق مثل هذا: يمكن تداخل الدالات، مما يسمح بالتعبيرات المعقدة والحسابات. في ما يلي مثال آخر يعطي إجمالي المبيعات الحالي لليوم باستخدام مقاييس لكل منتج من مبيعات كل دقيقة: تقوم الدالة سومزيريز بحساب سلسلة زمنية تمثل مجموع كل مقياس يتطابق مع نمط product..salesPerMinute. ثم يحسب لا يتجزأ مجموع تشغيل بدلا من عدد في الدقيقة الواحدة. من هنا ليس من الصعب جدا أن نتصور كيف يمكن للمرء أن بناء واجهة المستخدم على شبكة الإنترنت لعرض والتلاعب الرسوم البيانية. الجرافيت يأتي مع واجهة المستخدم الملحن الخاصة بها، هو مبين في الشكل 7.3. التي تقوم بذلك باستخدام جافا سكريبت لتعديل المعلمات ورل الرسوم البيانية كما ينقر المستخدم من خلال القوائم من الميزات المتاحة. الشكل 7.3: الجرافيت الملحن واجهة 7.4. لوحات التحكم منذ إنشائها تم استخدام الجرافيت كأداة لإنشاء لوحات على شبكة الإنترنت. إن واجهة برمجة تطبيقات عنوان ورل تجعل هذه حالة استخدام طبيعية. جعل لوحة التحكم بسيطة مثل جعل صفحة هتمل كاملة من العلامات مثل هذا: ومع ذلك، ليس الجميع يحب صياغة عناوين ورل باليد، لذلك يوفر غرافيتس كومبوسر أوي طريقة نقطة والنقر لإنشاء رسم بياني يمكنك ببساطة نسخ و الصق عنوان ورل. عندما يقترن مع أداة أخرى تسمح بإنشاء السريع لصفحات الويب (مثل ويكي) هذا يصبح من السهل بما فيه الكفاية أن المستخدمين غير التقنية يمكن بناء لوحات خاصة بهم بسهولة جدا. 7.5. عنق الزجاجة واضح مرة واحدة بدأ المستخدمين بناء لوحات، بدأ الجرافيت بسرعة أن يكون قضايا الأداء. لقد تحققت من سجلات خادم الويب لمعرفة الطلبات التي كانت تعثر عليها. وكان من الواضح جدا أن المشكلة هي العدد الهائل من طلبات الرسوم البيانية. كان ويباب متجهة بو، وتقديم الرسوم البيانية باستمرار. لقد لاحظت أن هناك الكثير من الطلبات المتطابقة، وكانت اللوم على لوحات. تخيل أن لديك لوحة القيادة مع 10 الرسوم البيانية في ويتم تحديث الصفحة مرة واحدة في الدقيقة. في كل مرة يفتح فيها المستخدم لوحة التحكم في متصفحه، يجب على غرافيت التعامل مع 10 طلبات إضافية في الدقيقة الواحدة. هذا يصبح بسرعة مكلفة. الحل البسيط هو تقديم كل رسم بياني مرة واحدة فقط ثم تقديم نسخة منه لكل مستخدم. إطار الويب دجانغو (الذي بنيت الجرافيت على) يوفر آلية التخزين المؤقت ممتازة التي يمكن استخدام نهايات الظهر المختلفة مثل ممكاشيد. ممكاشيد 3 هو في الأساس جدول التجزئة المقدمة كخدمة شبكة. يمكن الحصول على التطبيقات العميل وتعيين أزواج القيمة الرئيسية تماما مثل الجدول التجزئة العادية. الفائدة الرئيسية لاستخدام ممكاشيد هو أن نتيجة لطلب مكلفة (مثل تقديم الرسم البياني) يمكن تخزينها بسرعة كبيرة واسترجاعها في وقت لاحق للتعامل مع الطلبات اللاحقة. لتجنب عودته نفس الرسوم البيانية القديمة إلى الأبد، يمكن تكوين ممكاشيد لإنهاء الرسوم البيانية المخزنة مؤقتا بعد فترة قصيرة. حتى لو كان هذا هو بضع ثوان فقط، والعبء الذي يأخذ قبالة الجرافيت هو هائل بسبب طلبات مكررة شائعة جدا. حالة شائعة أخرى التي تخلق الكثير من تقديم الطلبات هو عندما يقوم المستخدم بتعديل خيارات العرض وتطبيق وظائف في واجهة مستخدم الملحن. في كل مرة يقوم المستخدم بتغيير شيء ما، يجب على الجرافيت إعادة رسم الرسم البياني. يتم تضمين نفس البيانات في كل طلب لذلك فمن المنطقي لوضع البيانات الأساسية في ممكاش كذلك. وهذا يحافظ على واجهة المستخدم استجابة للمستخدم لأنه يتم تخطي خطوة استرداد البيانات. 7.6. تحسين إو تخيل أن لديك 60،000 المقاييس التي ترسلها إلى خادم الجرافيت الخاص بك، ولكل من هذه المقاييس نقطة بيانات واحدة في الدقيقة الواحدة. تذكر أن كل مقياس له ملف الهمس الخاص به على نظام الملفات. وهذا يعني أن الكربون يجب أن تفعل عملية الكتابة واحدة إلى 60،000 ملفات مختلفة في كل دقيقة. طالما أن الكربون يمكن أن يكتب إلى ملف واحد كل ميلي ثانية واحدة، ينبغي أن تكون قادرة على مواكبة. هذا ليس بعيد المنال، ولكن يتيح القول أن لديك 600،000 مقاييس تحديث كل دقيقة، أو المقاييس الخاصة بك يتم تحديث كل ثانية، أو ربما كنت ببساطة لا تستطيع تحمل تخزين سريع بما فيه الكفاية. مهما كانت الحالة، افترض أن معدل نقاط البيانات الواردة يتجاوز معدل عمليات الكتابة التي يمكن تخزينها مواكبة. كيف ينبغي التعامل مع هذا الوضع معظم محركات الأقراص الصلبة هذه الأيام لها وقت بحث بطيء 4. وهذا هو، والتأخير بين القيام عمليات إو في موقعين مختلفين، مقارنة مع كتابة تسلسل متجاورة من البيانات. وهذا يعني أن الكتابة أكثر متجاورة نقوم به، والمزيد من الإنتاجية نحصل عليها. ولكن إذا كان لدينا الآلاف من الملفات التي تحتاج إلى أن تكون مكتوبة بشكل متكرر، ولكل كتابة صغيرة جدا (واحد نقطة البيانات الهمس هو 12 بايت فقط) ثم لدينا أقراص هي بالتأكيد سوف تنفق معظم وقتهم تسعى. العمل تحت افتراض أن معدل عمليات الكتابة لديها سقف منخفض نسبيا، والطريقة الوحيدة لزيادة إنتاجنا نقطة البيانات وراء هذا المعدل هو كتابة نقاط بيانات متعددة في عملية الكتابة واحدة. هذا أمر ممكن لأن الهمس يرتب نقاط البيانات المتتالية بشكل متنازع على القرص. لذلك أضفت وظيفة أوبداتيماني إلى الهمس. الذي يأخذ قائمة من نقاط البيانات لمقياس واحد ويجمع نقاط البيانات المتجاورة في عملية الكتابة واحدة. على الرغم من أن هذا جعل كل الكتابة أكبر، والفرق في الوقت الذي يستغرقه لكتابة عشر نقاط البيانات (120 بايت) مقابل نقطة بيانات واحدة (12 بايت) لا يكاد يذكر. يستغرق الأمر عدد قليل جدا من نقاط البيانات قبل أن يبدأ حجم كل كتابة يؤثر بشكل ملحوظ على زمن الاستجابة. بعد ذلك نفذت آلية التخزين المؤقت في الكربون. يتم تعيين كل نقطة بيانات واردة إلى قائمة انتظار استنادا إلى اسم المقياس ثم يتم إلحاقه بهذه اللائحة. آخر مؤشر ترابط مرارا وتكرار مرارا وتكرارا من خلال كل من قوائم الانتظار ولكل واحد أنه يسحب كل من النقاط البيانات ويكتبها إلى ملف الهمس المناسب مع أوبداتيماني. بالعودة إلى مثالنا، إذا كان لدينا 600،000 مقاييس تحديث كل دقيقة ويمكن تخزين لدينا فقط مواكبة 1 الكتابة لكل ميلي ثانية واحدة، ثم الطوابير سوف ينتهي الأمر عقد حوالي 10 نقاط البيانات كل في المتوسط. المورد الوحيد الذي يكلفنا هو الذاكرة، التي هي وفيرة نسبيا منذ كل نقطة البيانات ليست سوى عدد قليل من وحدات البايت. هذه الاستراتيجية بشكل حيوي مخازن العديد من داتابوانتس حسب الضرورة للحفاظ على معدل داتابوانتس واردة التي قد تتجاوز معدل عمليات إو التخزين الخاص بك يمكن مواكبة. وهناك ميزة لطيفة من هذا النهج هو أنه يضيف درجة من المرونة للتعامل مع التباطؤ إو مؤقت. إذا كان النظام يحتاج إلى القيام بأعمال أخرى إو خارج الجرافيت فمن المرجح أن معدل عمليات الكتابة سوف تنخفض، في هذه الحالة سوف طوابير الكربون سوف تنمو ببساطة. وكلما كانت الطوابير أكبر، كلما كانت الكتابة أكبر. وبما أن الإنتاجية الإجمالية لنقاط البيانات تساوي معدل عمليات الكتابة التي تفوق متوسط ​​حجم كل كتابة، فإن الكربون قادر على مواكبة ما دام هناك ذاكرة كافية للصفوف. ويوضح الشكل 7.4 آلية طابور الكربون s. الشكل 7.4: آلية قائمة انتظار الكربونات 7.7. الحفاظ عليه في الوقت الحقيقي نقاط التخزين المؤقت كانت وسيلة لطيفة لتحسين الكربون إو ولكن لم تستغرق وقتا طويلا للمستخدمين بلدي لاحظ تأثير جانبي مزعج نوعا ما. بعد إعادة النظر في مثالنا مرة أخرى، حصلنا على 600،000 مقاييس يتم تحديثها كل دقيقة، وكان على افتراض أن التخزين لدينا يمكن أن يستمر فقط مع 60،000 عمليات الكتابة في الدقيقة الواحدة. وهذا يعني أننا سوف يكون لدينا ما يقرب من 10 دقيقة من البيانات التي تجلس في طوابير الكربون ق في أي وقت من الأوقات. للمستخدم يعني هذا أن الرسوم البيانية التي يطلبونها من ويباب الجرافيت سوف تكون في عداد المفقودين أحدث 10 دقيقة من البيانات: ليست جيدة لحسن الحظ الحل هو مستقيم إلى الأمام. أنا ببساطة إضافة مستمع مأخذ إلى الكربون الذي يوفر واجهة الاستعلام للوصول إلى نقاط البيانات المخزنة ثم تعديل ويباب الجرافيت لاستخدام هذه الواجهة في كل مرة يحتاج إلى استرداد البيانات. و ويباب ثم يجمع بين نقاط البيانات التي يستردها من الكربون مع نقاط البيانات التي استرجعت من القرص وفويلا، والرسوم البيانية هي في الوقت الحقيقي. منحت، في مثالنا يتم تحديث نقاط البيانات إلى دقيقة وبالتالي ليس بالضبط في الوقت الحقيقي، ولكن حقيقة أن كل نقطة البيانات يمكن الوصول إليها على الفور في الرسم البياني مرة واحدة يتم تلقيها من قبل الكربون هو في الوقت الحقيقي. 7.8. نواة، مخابئ، والفشل الكارثي كما هو واضح ربما من الآن، سمة رئيسية من أداء النظام أن الأداء الجرافيت الخاصة يعتمد على الكمون إو. لقد افترضنا حتى الآن أن نظامنا كان منخفضا باستمرار إو كمون متوسط ​​حوالي 1 ميلي ثانية واحدة في الكتابة، ولكن هذا هو الافتراض الكبير الذي يتطلب تحليلا أعمق قليلا. معظم محركات الأقراص الصلبة ببساطة أرينت أن بسرعة حتى مع العشرات من الأقراص في مجموعة ريد هناك من المرجح جدا أن يكون أكثر من 1 ميلي ثانية واحدة الكمون للوصول العشوائي. ولكن إذا حاولت اختبار مدى سرعة كتابة كمبيوتر محمول قديم بكتابة كيلوبايت كاملة إلى القرص، فستجد أن مكالمة نظام الكتابة تعود في أقل من 1 ميلي ثانية واحدة. لماذا كلما كان البرنامج لديه خصائص أداء غير متناسقة أو غير متوقعة، عادة إما التخزين المؤقت أو التخزين المؤقت هو اللوم. في هذه الحالة، كانت تتعامل مع الاثنين معا. الكتابة نظام الدعوة لا يكتب من الناحية الفنية البيانات الخاصة بك إلى القرص، فإنه ببساطة يضعه في المخزن المؤقت الذي النواة ثم يكتب إلى القرص في وقت لاحق. هذا هو السبب في أن المكالمة الكتابة عادة ما يعود بسرعة. حتى بعد أن يتم كتابة المخزن المؤقت إلى القرص، فإنه غالبا ما تبقى مخبأة للقراءة لاحقة. كل من هذه السلوكيات، التخزين المؤقت والتخزين المؤقت، تتطلب الذاكرة بالطبع. المطورين النواة، كونهم الناس الذكية التي هي، قررت أنه سيكون فكرة جيدة لاستخدام كل الذاكرة مساحة المستخدم خالية حاليا بدلا من تخصيص الذاكرة صراحة. هذا اتضح أن تكون مفيدة للغاية معززة الأداء، وأنه يفسر أيضا لماذا بغض النظر عن مقدار الذاكرة التي تضيفها إلى نظام فإنه عادة ما ينتهي بها ما يقرب من الصفر الذاكرة الحرة بعد القيام بكمية متواضعة من إو. إذا كانت تطبيقات مساحة المستخدم الخاصة بك تتغاضى باستخدام تلك الذاكرة فإن نواة الخاص بك ربما تكون. الجانب السلبي لهذا النهج هو أن هذه الذاكرة الحرة يمكن أن تؤخذ بعيدا عن النواة لحظة تطبيق مساحة المستخدم يقرر أنه يحتاج إلى تخصيص المزيد من الذاكرة لنفسها. وليس لدى النواة أي خيار سوى التخلي عنها، وفقدان أي مخزونات قد تكون موجودة هناك. لذلك ماذا يعني كل هذا بالنسبة ل غرافيت نحن فقط سلط الضوء على الكربون الاعتماد على منخفضة باستمرار إو الكمون ونحن نعلم أيضا أن المكالمة نظام الكتابة يعود فقط بسرعة لأن البيانات هو مجرد نسخها إلى المخزن المؤقت. ماذا يحدث عندما لا يكون هناك ذاكرة كافية للنواة لمواصلة التخزين المؤقت يكتب تصبح الكتابة متزامنة وبالتالي بطيئة بشكل رهيب وهذا يسبب انخفاض كبير في معدل عمليات الكتابة الكربون، مما يسبب طوابير الكربون في النمو، الذي يأكل أكثر من ذلك الذاكرة، تجويع نواة أبعد من ذلك. في نهاية المطاف، وهذا النوع من الوضع عادة ما يؤدي إلى الكربون نفاد الذاكرة أو قتله من قبل سيسادمين غاضب. لتجنب هذا النوع من الكوارث، أضفت العديد من الميزات إلى الكربون بما في ذلك حدود شكلي على كيفية العديد من نقاط البيانات يمكن أن تكون قائمة الانتظار وحدود معدل على مدى سرعة عمليات الهمس المختلفة يمكن القيام بها. هذه الميزات يمكن أن تحمي الكربون من تصاعد خارج نطاق السيطرة وبدلا من ذلك فرض آثار أقل قاسية مثل إسقاط بعض نقاط البيانات أو رفض قبول المزيد من نقاط البيانات. ومع ذلك، القيم المناسبة لتلك الإعدادات هي نظام معين وتتطلب قدرا لا بأس به من الاختبار لحن. وهي مفيدة ولكنها لا تحل المشكلة بشكل أساسي. لذلك، تحتاج أيضا المزيد من الأجهزة. 7.9. التجميع مما يجعل العديد من ملقمات الجرافيت يبدو أن نظام واحد من وجهة نظر المستخدم ليس صعبا بشكل رهيب، على الأقل لتنفيذ نيوملف. يتكون تفاعل المستخدم ويبابس في المقام الأول من عمليتين: العثور على المقاييس وجلب نقاط البيانات (عادة في شكل رسم بياني). يتم العثور على عمليات البحث والجلب من ويباب بعيدا في مكتبة أن ملخصات تنفيذها من بقية كودباس، وأنها تتعرض أيضا من خلال معالجات طلب هتب للمكالمات عن بعد سهلة. تبحث عملية البحث عن نظام الملفات المحلي لبيانات الهمس للأشياء التي تتطابق مع نمط محدد من قبل المستخدم، تماما كما يتطابق نظام الملفات مثل. txt مع الملفات مع تلك الإضافة. كونها هيكل شجرة، والنتيجة عادت من قبل العثور على مجموعة من الكائنات عقدة، كل مشتق من فرع أو ليف الطبقات الفرعية من العقدة. الدلائل تتوافق مع العقد فرع والملفات الهمس تتوافق مع العقد ورقة. هذه الطبقة من التجريد يجعل من السهل لدعم أنواع مختلفة من التخزين الأساسي بما في ذلك ملفات رد 5 و غزيبد الملفات الهمس. تعرف واجهة ليف طريقة الجلب التي يعتمد تنفيذها على نوع عقدة الورقة. في حالة الملفات الهمس هو مجرد المجمع رقيقة حول مكتبة الهمس جلب وظيفة الخاصة. عندما تم إضافة دعم التجمع، تم تمديد وظيفة البحث لتكون قادرة على إجراء المكالمات عن بعد تجد عبر هتب إلى خوادم الجرافيت الأخرى المحددة في تكوين ويبابس. بيانات العقدة الواردة في نتائج هذه المكالمات هتب يحصل ملفوفة كائنات ريموتينود التي تتفق مع العقدة المعتادة. فرع شجرة. و ليف واجهات. وهذا يجعل التجمع شفافة لبقية كودبابس ويبابس. يتم تنفيذ طريقة الجلب لعقدة ورقة بعيدة كمكالمة هتب أخرى لاسترداد نقاط البيانات من خادم الجرافيت العقد. يتم إجراء كل هذه المكالمات بين ويبابس بنفس الطريقة التي سيقوم العميل بالاتصال بها، باستثناء معلمة إضافية واحدة تحدد أن العملية يجب أن تتم محليا فقط ولا يتم إعادة توزيعها في المجموعة. عندما يطلب من ويباب لتقديم رسم بياني، فإنه ينفذ عملية البحث لتحديد المقاييس المطلوبة والمكالمات جلب على كل لاسترداد نقاط البيانات الخاصة بهم. هذا يعمل ما إذا كانت البيانات على الملقم المحلي، الملقمات البعيدة، أو كليهما. إذا كان الخادم ينخفض، والمكالمات المكالمات عن بعد بسرعة إلى حد ما والملقم يتم وضع علامة على أنها خارج الخدمة لفترة قصيرة خلالها لا يتم إجراء مزيد من المكالمات إليها. من وجهة نظر المستخدم، أيا كانت البيانات على الملقم المفقود ستكون مفقودة من الرسوم البيانية ما لم يتم تكرار هذه البيانات على ملقم آخر في الكتلة. 7.9.1. تحليل موجز لكفاءة التجميع يعد الجزء الأكبر من طلب الرسوم البيانية هو الرسم البياني. يتم تنفيذ كل تقديم من قبل خادم واحد لذلك إضافة المزيد من الملقمات لا يزيد من فعالية القدرة على تقديم الرسوم البيانية. ومع ذلك، فإن حقيقة أن العديد من الطلبات في نهاية المطاف توزيع تجد المكالمات إلى كل ملقم آخر في الكتلة يعني أن لدينا نظام تجميع تقاسم الكثير من الحمل الأمامية بدلا من تشتيت ذلك. إلا أن ما حققناه في هذه المرحلة هو طريقة فعالة لتوزيع الحمل الخلفي، حيث يعمل كل مثيل من الكربون بشكل مستقل. هذه هي الخطوة الأولى الجيدة منذ معظم الوقت في نهاية الجزء الخلفي هو عنق الزجاجة بعيدة قبل الواجهة الأمامية، ولكن من الواضح أن الواجهة الأمامية لن نطاق أفقيا مع هذا النهج. من أجل جعل مقياس الواجهة الأمامية على نحو أكثر فعالية، يجب تخفيض عدد المكالمات البحث عن بعد التي أدلى بها ويباب. مرة أخرى، الحل الأسهل هو التخزين المؤقت. تماما كما تم استخدام ممكاشيد بالفعل لذاكرة التخزين المؤقت نقاط البيانات والرسوم البيانية المقدمة، ويمكن أيضا أن تستخدم لتخزين نتائج البحث عن طلبات. نظرا لأن موقع المقاييس يقل احتمال تغييره بشكل متكرر، فيجب عادة تخزينه مؤقتا لفترة أطول. ومع ذلك، فإن المفاضلة بين تعيين مهلة ذاكرة التخزين المؤقت للبحث عن نتائج طويلة جدا، هي أن المقاييس الجديدة التي تمت إضافتها إلى التسلسل الهرمي قد لا تظهر بسرعة للمستخدم. 7.9.2. توزيع المقاييس في الكتلة ويباب الجرافيت هو متجانس إلى حد ما في جميع أنحاء مجموعة، في أنه يؤدي نفس الوظيفة بالضبط على كل ملقم. دور الكربون، ومع ذلك، يمكن أن تختلف من خادم إلى خادم اعتمادا على ما هي البيانات التي تختار إرسالها إلى كل مثيل. في كثير من الأحيان هناك العديد من العملاء المختلفة إرسال البيانات إلى الكربون. لذلك سيكون مزعج جدا لزوجين كل تكوين العملاء مع تخطيط مجموعات الجرافيت الخاص بك. قد تذهب مقاييس التطبيق إلى خادم كربون واحد، في حين قد يتم إرسال مقاييس الأعمال إلى خوادم كربون متعددة للتكرار. لتبسيط إدارة سيناريوهات مثل هذا، الجرافيت يأتي مع أداة إضافية تسمى الكربون التتابع. وظيفتها بسيطة جدا أنها تتلقى بيانات متري من العملاء تماما مثل الخفي الكربون القياسية (الذي يسمى في الواقع الكربون مخبأ) ولكن بدلا من تخزين البيانات، فإنه يطبق مجموعة من القواعد لأسماء المقاييس لتحديد أي خوادم الكربون ذاكرة التخزين المؤقت لنقل البيانات إلى. تتكون كل قاعدة من تعبير عادي وقائمة من ملقمات الوجهة. بالنسبة لكل نقطة بيانات يتم تلقيها، يتم تقييم القواعد بالترتيب ويتم استخدام القاعدة الأولى التي يطابق تعبيرها العادي اسم المقياس. وبهذه الطريقة كل العملاء بحاجة إلى القيام به هو إرسال البيانات الخاصة بهم إلى التتابع الكربون، وسوف ينتهي المطاف على الملقمات المناسبة. وبمعنى ما، فإن التتابع الكهربي يوفر وظيفة النسخ المتماثل، على الرغم من أنه سيسمى على نحو أدق بازدواجية المدخلات نظرا لأنه لا يتناول مسائل التزامن. إذا كان الخادم ينخفض ​​مؤقتا، فإنه سوف يكون في عداد المفقودين نقاط البيانات للفترة الزمنية التي كان أسفل ولكن خلاف ذلك تعمل بشكل طبيعي. هناك نصوص إدارية تترك السيطرة على عملية إعادة المزامنة في يد مسؤول النظام. 7.10. تأملات التصميم لقد أكدت خبرتي في العمل على الجرافيت من جديد اعتقادا بأن قابليتي التدرجية لا تتمتعان إلا بقدر ضئيل جدا من الأداء المنخفض، بل هي نتاج التصميم العام. لقد واجهت العديد من الاختناقات على طول الطريق ولكن في كل مرة أنا أبحث عن التحسينات في التصميم بدلا من سرعة المنبثقة في الأداء. لقد سألت مرات عديدة لماذا كتبت الجرافيت في بيثون بدلا من جافا أو C، وردتي دائما أنني لم يأت بعد حاجة حقيقية للأداء الذي يمكن أن تقدمه لغة أخرى. في Knu74، قال دونالد نوث الشهير أن التحسين المبكر هو جذر كل الشر. طالما أننا نفترض أن قانوننا سوف تستمر في التطور بطرق غير تافهة ثم كل التحسين 6 هو في بعض معنى سابق لأوانه. واحدة من الجرافيت أكبر نقاط القوة وأكبر نقاط الضعف هو حقيقة أن القليل جدا منه كان في الواقع مصممة بالمعنى التقليدي. بشكل عام تطور الجرافيت تدريجيا، عقبة من قبل عقبة، كما نشأت مشاكل. وفي كثير من الأحيان كانت العقبات متوقعة، ويبدو أن الحلول الوقائية المختلفة كانت طبيعية. ومع ذلك يمكن أن يكون من المفيد تجنب حل المشاكل التي لم يكن لديك حتى الآن، حتى لو كان من المرجح أن كنت قريبا سوف. والسبب هو أنه يمكنك معرفة المزيد من الدراسة عن كثب الفشل الفعلي من النظرية حول استراتيجيات متفوقة. يحل حل المشكلة من قبل كل من البيانات التجريبية لدينا في متناول اليد ومعرفتنا والحدس. وجدت إيف أن التشكيك في حكمة الخاصة بك بما فيه الكفاية يمكن أن يجبر لك أن ننظر إلى البيانات التجريبية الخاصة بك أكثر شمولا. على سبيل المثال، عندما كتبت لأول مرة الهمس كنت مقتنعا أنه يجب أن يعاد كتابة في C للسرعة وأن تنفيذ بيثون بلدي لن يكون إلا بمثابة نموذج أولي. إذا كنت ويرنت تحت وقت أزمة أنا جيدا جدا قد تخطي تنفيذ بايثون تماما. اتضح أن إو هو عنق الزجاجة في وقت سابق من وحدة المعالجة المركزية أن كفاءة أقل من بايثون بالكاد المسائل على الإطلاق في الممارسة العملية. وكما قلت، على الرغم من أن النهج التطوري هو أيضا ضعف كبير من الجرافيت. واجهات، اتضح، لا تصلح جيدا للتطور التدريجي. واجهة جيدة متسقة وتوظف الاتفاقيات لتحقيق أقصى قدر من التنبؤ. من خلال هذا المقياس، واجهة برمجة التطبيقات ورل الجرافيت هو حاليا واجهة شبه قدم المساواة في رأيي. وقد تم تناول الخيارات والوظائف على مر الزمن، وأحيانا تشكل جزر صغيرة من الاتساق، ولكنها تفتقر عموما إلى الشعور العالمي بالاتساق. الطريقة الوحيدة لحل مثل هذه المشكلة هي من خلال إصدار من واجهات، ولكن هذا أيضا له عيوب. مرة واحدة تم تصميم واجهة جديدة، القديم لا يزال من الصعب التخلص من، العالقة حول كما تطوري الأمتعة مثل الملحق البشري. قد يبدو غير ضار بما فيه الكفاية حتى يوم واحد يحصل رمز الخاص بك التهاب الزائدة الدودية (أي علة مرتبطة واجهة القديمة) وكنت اضطر للعمل. إذا كان لي أن أتغير شيئا واحدا عن الجرافيت في وقت مبكر، كان من شأنه أن تأخذ رعاية أكبر بكثير في تصميم واجهات برمجة التطبيقات الخارجية، والتفكير قدما بدلا من تطويرها شيئا فشيئا. جانب آخر من الجرافيت الذي يسبب بعض الإحباط هو المرونة المحدودة لنموذج التسمية التسلسل الهرمي. في حين أنها بسيطة جدا ومريحة للغاية لمعظم حالات الاستخدام، فإنه يجعل بعض الاستفسارات المتطورة صعبة للغاية، حتى من المستحيل، للتعبير عن. عندما فكرت لأول مرة في خلق الجرافيت كنت أعرف من البداية أنني أردت الإنسان أديتابل أبي ورل لخلق الرسوم البيانية 7. في حين ايم لا يزال سعيدا أن الجرافيت يوفر هذا اليوم، يخشى هذا الشرط أعباء أبي مع بناء الجملة المفرطة أن يجعل التعبيرات المعقدة غير عملي. التسلسل الهرمي يجعل مشكلة تحديد المفتاح الأساسي لمقياس بسيط جدا لأن المسار هو في الأساس مفتاح أساسي لعقدة في الشجرة. الجانب السلبي هو أنه يجب تضمين جميع البيانات الوصفية (أي بيانات الأعمدة) مباشرة في المسار. الحل المحتمل هو الحفاظ على النموذج الهرمي وإضافة قاعدة بيانات تعريفية منفصلة لتمكين مزيد من التحديد المتقدم للمقاييس ذات بنية خاصة. 7.11. أن تصبح المصدر المفتوح إذا نظرنا إلى الوراء في تطور الجرافيت، ما زلت مندهشا على حد سواء من حيث أنها قد حان كمشروع وإلى أي مدى اتخذت لي كمبرمج. وبدأت كمشروع الحيوانات الأليفة التي كانت سوى بضع مئات من سطور من التعليمات البرمجية. بدأ محرك تقديم تجربة، ببساطة لمعرفة ما إذا كان يمكن أن يكتب واحد. تم كتابة الهمس على مدار عطلة نهاية الأسبوع من اليأس لحل مشكلة عرض سدادة قبل موعد إطلاق حرجة. وقد أعيد كتابة الكربون مرات أكثر مما يهمني أن أتذكر. مرة واحدة سمح لي للافراج عن الجرافيت تحت رخصة مفتوحة المصدر في عام 2008 لم أكن أتوقع حقا الكثير من الاستجابة. بعد بضعة أشهر ذكر في مقال نيت التي حصلت التقطت من قبل سلاشدوت والمشروع أخذت فجأة وكان نشطا منذ ذلك الحين. اليوم هناك العشرات من الشركات الكبيرة والمتوسطة الحجم باستخدام الجرافيت. المجتمع نشط جدا ويستمر في النمو. بعيدا عن كونه المنتج النهائي، وهناك الكثير من العمل التجريبي بارد يجري القيام به، مما يبقيه متعة للعمل على والكامل من الإمكانيات. لونشبادغرافيت هناك منفذ آخر على الكائنات المسلسل التي يمكن إرسالها، والتي هي أكثر كفاءة من تنسيق نص عادي. هذا مطلوب فقط لمستويات عالية جدا من حركة المرور. memcached. org محركات الأقراص الصلبة عادة ما يكون لها أوقات بحث سريعة للغاية مقارنة بالأقراص الصلبة التقليدية. ملفات رد هي في الواقع العقد فرع لأنها يمكن أن تحتوي على مصادر بيانات متعددة مصدر بيانات رد هو عقدة ورقة. كوث يعني على وجه التحديد تحسين مستوى منخفض المستوى، وليس الأمثل العيانية مثل تحسينات التصميم. هذا يجبر الرسوم البيانية نفسها لتكون مفتوحة المصدر. يمكن لأي شخص أن ننظر ببساطة إلى عنوان ورل الرسوم البيانية لفهم ذلك أو تعديل إيتسد الكوكب 24 فبراير 2017 المرشح الإصدار الثاني من نيتبسد 7.1 متاح الآن للتحميل في: أولئك منكم الذين يفضلون بناء من مصدر يمكن أن تستمر في متابعة نيتبسد-7 فرع أو استخدام علامة نيتبسد-7-1-RC2. وكانت معظم التغييرات التي أجريت منذ 7.1RC1 إصلاحات الأمان. راجع سردسوشانجيس-7.1 للقائمة الكاملة. يرجى مساعدتنا من خلال اختبار 7.1RC2. نحن نحب أي وجميع ردود الفعل. الإبلاغ عن المشاكل من خلال القنوات المعتادة (تقديم العلاقات العامة أو الكتابة إلى القائمة المناسبة). ردود الفعل أكثر عمومية هو موضع ترحيب في email160protected 23 فبراير 2017 الاهداف: لاستخدام بكغومب 2.0 لبناء مستودع ثنائي من جميع الحزم كنت مهتما في للحفاظ على مستودع الطازجة على أساس يومي واستخدام هذا المستودع مع بكين للحفاظ على ماك الخاص بك نظام ما يصل إلى تاريخ وآمنة. ويستهدف هذا البرنامج التعليمي على وجه التحديد في ماك ويعتمد على حزمة المثبت الذاتي الخاصة ماكوس. للحصول على برنامج تعليمي أكثر عمومية يستخدم حزمة بكغكومب-كرون في يكغرك، انظر حفظ نيتبسد ما يصل إلى موعد مع بكغكومب 2.0. البدء أولا قم بتحميل وتثبيت حزمة المثبت ماك المستقلة. للعثور على الملف الصحيح، انتقل إلى صفحة الإصدارات على جيثب. واختيار أحدث إصدار، وتحميل الملف مع اسم النموذج بكغكومب-لتفرزيونغت-macos. pkg. ثم انقر نقرا مزدوجا فوق الملف الذي قمت بتنزيله واتبع إرشادات التثبيت. سوف يطلب منك كلمة مرور المسؤول لأن المثبت لديه لوضع الملفات تحت ملاحظة أوسرلوكال أن بكغكومب يتطلب امتيازات الجذر على أي حال لتشغيل (لأنه يستخدم كروت (8) داخليا)، لذلك سيكون لديك لمنح الإذن في مرحلة ما أو أخرى. يقوم المثبت بتعديل باث الافتراضي (عن طريق إنشاء etc. paths. dpkgcomp) لتضمين دليل التثبيت الخاص بكغكومبس و بادئة التثبيت يكسرس. إعادة تشغيل جلسات شل لجعل هذا التغيير فعالا، أو تحديث البرامج النصية بدء التشغيل شل الخاصة بك وفقا لذلك إذا كنت لا تستخدم تلك القياسية. وأخيرا، تأكد من أن يكون كسكودي المثبتة في موقع ApplicationXcode. app القياسية وأن جميع المكونات المطلوبة لبناء تطبيقات سطر الأوامر متوفرة. نصيحة: حاول تشغيل نسخة سيسي من سطر الأوامر ورؤية ما إذا كان يطبع رسالة الاستخدام. Adjusting the configuration The macOS flavor of pkgcomp is configured with an installation prefix of usrlocal. which means that the executable is located in usrlocalsbinpkgcomp and the configuration files are in usrlocaletcpkgcomp. This is intentional to keep the pkgcomp installation separate from your pkgsrc installation so that it can run no matter what state your pkgsrc installation is in. The configuration files are as follows: usrlocaletcpkgcompdefault. conf. This is pkgcomps own configuration file and the defaults configured by the installer should be good to go for macOS. In particular, packages are configured to go into optpkg instead of the traditional usrpkg. This is a necessity because the latter is not writable starting with OS X El Capitan thanks to System Integrity Protection (SIP). usrlocaletcpkgcompsandbox. conf. This is the configuration file for sandboxctl, which is the support tool that pkgcomp uses to manage the compilation sandbox. The default settings configured by the installer should be good. usrlocaletcpkgcompextra. mk. conf. This is pkgsrcs own configuration file. In here, you should configure things like the licenses that are acceptable to you and the package-specific options youd like to set. You should not configure the layout of the installed files (e. g. LOCALBASE ) because thats handled internally by pkgcomp as specified in default. conf . usrlocaletcpkgcomplist. txt. This determines the set of packages you want to build automatically (either via the auto command or your periodic cron job). The automated builds will fail unless you list at least one package. Make sure to list pkgin here to install a better binary package management tool. Youll find this very handy to keep your installation up-to-date. Note that these configuration files use the varpkgcomp directory as the dumping ground for: the pkgsrc tree, the downloaded distribution files, and the built binary packages. We will see references to this location later on. The cron job The installer configures a cron job that runs as root to invoke pkgcomp daily. The goal of this cron job is to keep your local packages repository up-to-date so that you can do binary upgrades at any time. You can edit the cron job configuration interactively by running sudo crontab - e . This cron job wont have an effect until you have populated the list. txt file as described above, so its safe to let it enabled until you have configured pkgcomp. If you want to disable the periodic builds, just remove the pkgcomp entry from the crontab. On slow machines, or if you are building a lot of packages, you may want to consider decreasing the build frequency from daily to weekly . Sample configuration Here is what the configuration looks like on my Mac Mini as dumped by the config subcommand. Use this output to get an idea of what to expect. Ill be using the values shown here in the rest of the tutorial: Building your own packages by hand Now that you are fully installed and configured, youll build some stuff by hand to ensure the setup works before the cron job comes in. The simplest usage form, which involves full automation and assumes you have listed at least one package in list. txt. is something like this: This trivially-looking command will: clone or update your copy of pkgsrc create the sandbox bootstrap pkgsrc and pbulk use pbulk to build the given packages and destroy the sandbox. After a successful invocation, youll be left with a collection of packages in the varpkgcomppackages directory. If youd like to restrict the set of packages to build during a manually-triggered build, provide those as arguments to auto. This will override the contents of AUTOPACKAGES (which was derived from your list. txt file). But what if you wanted to invoke all stages separately, bypassing auto. The command above would be equivalent to: Go ahead and play with these. You can also use the sandbox-shell command to interactively enter the sandbox. See pkgcomp(8) for more details. Lastly note that the root user will receive email messages if the periodic pkgcomp cron job fails, but only if it fails. That said, you can find the full logs for all builds, successful or not, under varpkgcomplog . Installing the resulting packages Now that you have built your first set of packages, you will want to install them. This is easy on macOS because you did not use pkgsrc itself to install pkgcomp. First, unpack the pkgsrc installation. You only have to do this once: Thats it. You can now install any packages you like: The command above assume you have restarted your shell to pick up the correct path to the pkgsrc installation. If the call to pkgadd fails because of a missing binary, try restarting your shell or explicitly running the binary as optpkgsbinpkgadd . Keeping your system up-to-date Thanks to the cron job that builds your packages, your local repository under varpkgcomppackages will always be up-to-date you can use that to quickly upgrade your system with minimal downtime. Assuming you are going to use pkgtoolspkgin as recommended above (and why not), configure your local repository: And, from now on, all it takes to upgrade your system is: February 22, 2017 At the obvious risk of this post getting downvoted and eventually closed as too biasedopionated, Id nevertheless ask this question. The NetBSD projects tagline is of course, it runs NetBSD. I understand that one of the main goals is to run on every possible hardware out there (pages on the internet are full of possible hyperbole, such as anything with a computing chip in it, even a toaster shall run NetBSD). However, if you examine the webpages of IoT hardware from mid-2010s, there is poor visibility of NetBSD as the first choice of OS. Eg. on the Raspberry Pi, Raspbian OS is regarded as the go-to starter OS. Arduinos Wikipedia page says that it runs either Windows, macOS or Linux. Snappy Ubuntu-Core and even Win10 IoT (gasp) are staking a claim as leading OSes in the IoT market. While I understand that the last two OSes mentioned above have corporate muscle-power behind them, even open-source job requirement listings do not place much emphasis on NetBSD expertise. The question distills down to: Why is NetBSD not considered the first-rate choice in these IoT hardware. This seems as an anti-pattern given the projects canonical goals All of a sudden (read: without changing any parameters) my netbsd virtualmachine started acting oddly. The symptoms concern ssh tunneling. From my laptop I launch: Then, in another shell: The ssh debug says: I tried also with localhost:80 to connect to the (remote) web server, with identical results. The remote host runs NetBSD: I am a bit lost. I tried running tcpdump on the remote host, and I spotted these bad chksum: I tried restarting the ssh daemon to no avail. I havent rebooted yet - perhaps somebody here can suggest other diagnostics. I think it might either be the virtual network card driver, or somebody rooted our ssh. February 20, 2017 Introduction I have been working on and off for almost a year trying to get reproducible builds (the same source tree always builds an identical cdrom) on NetBSD. I did not think at the time it would take as long or be so difficult, so I did not keep a log of all the changes I needed to make. I was also not the only one working on this. Other NetBSD developers have been making improvements for the past 6 years. I would like to acknowledge the NetBSD build system (aka build. sh ) which is a fully portable cross-build system. This build system has given us a head-start in the reproducible builds work. I would also like to acknowledge the work done by the Debian folks who have provided a platform to run, test and analyze reproducible builds. Special mention to the diffoscope tool that gives an excellent overview of whats different between binary files, by finding out what they are (and if they are containers what they contain) and then running the appropriate formatter and diff program to show whats different for each file. Finally other developers who have started, motivated and did a lot of work getting us here like Joerg Sonnenberger and Thomas Klausner for their work on reproducible builds, and Todd Vierling and Luke Mewburn for their work on build. sh. Sources of difference Heres is what we found that we needed to fix, how we chose to fix it and why, and where are we now. There are many reasons why two separate builds from the same sources can be different. Heres an (incomplete) list: timestamps Many things like to keep track of timestamps, specially archive formats ( tar(1) . ar(1) ), filesystems etc. The way to handle each is different, but the approach is to make them either produce files with a 0 timestamp (where it does not matter like ar), or with a specific timestamp when using 0 does not make sense (it is not useful to the user). datestimesauthors etc. embedded in source files Some programs like to report the datetime they were built, the author, the system they were built on etc. This can be done either by programmatically finding and creating source files containing that information during build time, or by using standard macros such as DATE, TIME etc. Usually putting a constant time or eliding the information (such as we do with kernels and bootblocks) solves the problem. timezone sensitive code Certain filesystem formats (iso 9660 etc.) dont store raw timestamps but formatted times to achieve this they convert from a timestamp to localtime, so they are affected by the timezone. directory orderbuild order The build order is not constant especially in the presence of parallel builds neither is directory scan order. If those are used to create output files, the output files will need to be sorted so they become consistent. non-sanitized data stored into files Writing data structures into raw files can lead to problems. Running the same program in different operating systems or using ASLR makes those issues more obvious. symbolic linkspaths Having paths embedded into binaries (specially for debugging information) can lead to binary differences. Propagation of the logical path can prove problematic. general tool inconsistencies gcc(1) profiling uses a PROFILEHOOK macro on RISC targets that utilizes the current function number to produce labels. Processing order of functions is not guaranteed. gpt(8) creation involves uuid generation these are generally random. block allocation on msdos filesystems had a random component. makefs(8) uses timezones with timestamps (iso9660 ), randomness for block selection (msdos ), stores stray pointers in superblock (ffs ). Every program that is used to generate other output needs to have consistent results. In NetBSD this is done with build. sh. which builds a set of tools from known sources before it can use those tools to build the rest of the system). There is a large number of tools. There are also internal issues with the tools that make their output non reproducible, such as nondeterministic symbol creation or capturing parts of the environment in debugging information. build information tunables environment There are many environment settings, or build variable settings that can affect the build. This needs to be kept constant across builds so weve changed the list of variables that are reported in Makefile. params. making sure that the source tree has no local changes Variables controlling reproducible builds Reproducible builds are controlled on NetBSD with two variables: MKREPRO (which can be set to yes or no) and MKREPROTIMESTAMP which is used to set the timestamp of the builds artifacts. This is usually set to the number of seconds from the epoch. The build. sh - P flag handles reproducible builds automatically: sets the MKREPRO variable to yes, and then finds the latest source file timestamp in the tree and sets MKREPROTIMESTAMP to that. Handling timestamps The first thing that we needed to understand was how to deal with timestamps. Some of the timestamps are not very useful (for example inside random ar archives) so we choose to 0 them out. Others though become annoying if they are all 0. What does it mean when you mount install media and all the dates on the files are Jan 1, 1970 We decided that a better timestamp would be the timestamp of the most recently modified file in the source tree. Unfortunately this was not easy to find on NetBSD, because we are still using CVS as the source control system, and CVS does not have a good way to provide that. For that we wrote a tool called cvslatest. that scans the CVS metadata files (CVSEntries) and finds the latest commit. This works well for freshly checked out trees (since CVS uses the source timestamp when checking out), but not with updated trees (because CVS uses the current time when updating files, so that make(1) thinks theyve been modified). To fix that, weve added a new flag to the cvs(1) update command - t . that uses the source checkout time. The build system needs now to evaluate the tree for the latest file running cvslatest(1) and find the latest timestamp in seconds from the Epoch which is set in the MKREPROTIMESTAMP variable. This is the same as SOURCEDATEEPOCH. Various Makefiles are using this variable and MKRERPO to determine how to produce consistent build artifacts. For example many commands ( tar(1) . makefs(8) . gpt(8) . ) have been modified to take a --timestamp or - T command line switch to generate output files that use the given timestamp, instead of the current time. Other software (am-utils, acpica, bootblocks, kernel) used DATE or TIME, or captured the user, machine, etc. from the environment and had to be changed to a constant time, user, machine, etc. roff(7) documents used the td macro to generate the date of formatting in the document have been changed to conditionally use the macro based on register R . for example as in intro. me and then the Makefile was changed to set that register for MKREPRO. Handling Order We dont control the build order of things and we also dont control the directory order which can be filesystem dependent. The collation order also is environment specific, and sorting needs to be stable (we have not encountered that problem yet). Two different programs caused us problems here: file(1) with the generation of the compiled magic file using directory order (fixed by changing file(1) ). install-info(1) . texinfo(5) files that have no specific order. For that we developed another tool called sortinfo(1) that sorts those files as a post-process step. Fortunately the filesystem builders and tar programs usually work with input directories that appear to have a consistent order so far, so we did not have to fix things there. Permissions NetBSD already keeps permissions for most things consistent in different ways: the build system uses install(8) and specifies ownership and mode. the mtree(8) program creates build artifacts using consistent ownership and permissions. Nevertheless, the various architecture-specific distribution media installers used cp(1) mkdir(1) and needed to be corrected. Most of the issues found had to do with capturing the environment in debugging information. The two biggest issues were: DWATProducer and DWATcompdir . Here you see two changes we made for reproducible builds: We chose to allow variable names (and have gcc(1) expand them) for the source of the prefix map because the source tree location can vary. Others have chosen to skip - fdebug-prefix-map from the variables to be listed. We added - fdebug-regex-map so that we could handle the NetBSD specific objdir build functionality. Object directories can have many flavors in NetBSD so it was difficult to use - fdebug-prefix-map to capture that. DWATcompdir presented a different challenge. We got non-reproducibility when building on paths where either the source or the object directories contained symbolic links. Although gcc(1) does the right thing handling logical paths (respects PWD), we found that there were problems both in the NetBSD sh(1) (fixed here ) and in the NetBSD make(1) (fixed here ). Unfortunately we cant depend on the shell to obey the logical path so we decided to go with: This works because make(1) is a tool (part of the toolchain we provide) whereas sh(1) is not. Another weird issue popped up on sparc64 where a single file in the whole source tree does not build reproducibly. This file is asn1krb5asn1.c which is generated in here. The problem is that when profiling on RISC machines gcc uses the PROFILEHOOK macro which in turn uses the function number to generate labels. This number is assigned to each function in a source file as it is being compiled. Unfortunately this number is not deterministic because of optimization (a bug), but fortunately turning optimization off fixes the problem. Status and future work As of 2017-02-20 we have fully reproducible builds on amd64 and sparc64. We are planning to work on the following areas: Vary more parameters on the system build (filesystem types, build OSs) Verify that cross building is reproducible Verify that unprivileged builds work Test on all the platforms February 19, 2017 At the second annual PillarCon. I facilitated a workshop called Fundamentals of C and Embedded using Mob Programming. On a Mac, we test-drove toggling a Raspberry Pis onboard LED. Before and after Before: ACT LED off Here are the takeaways we wrote down: Could test return type of main() Why wasnt numcalls 0 to begin with Maybe provide the mocks in advance (maybe use CMock ) Fun idea: fake GPIO device Vim tricks Cool But maybe use an easier editor for target audience Appropriate amount of effort need bigger payoff Mob programming supported the learning processobjective My own thoughts for next time I do this material: Try: providing the mocks in the starting state Keep: providing multi-target Makefile and prebuilt cross compiler Try: using a more discoverable (e. g. non-modal) text editor Keep: being prepared with a test list Try: providing already-written test cases to uncomment one at a time (one of the aspects of James Grennings training course I especially loved) Keep: being prepared with corners to cut if time gets short Try: knowing more of the mistakes we might make when cutting corners Keep: mobbing Participants who already knew some of this stuff liked th e mobbing (new to some of them) and appreciated how I structured the material to unfold. Participants who were new to C andor embedded (my target audience) came away feeling that they neednt be intimidated by it, and that programming in this context can be as fun and feedbacky as theyre accustomed to. Play along at home Then follow the steps outlined in the README . Further learning Youre welcome to use the workshop materials for any purpose, including your own workshop. If you do, Id love to hear about it. Or if youd like me to come facilitate it for your company, meetup group, etc. lets talk. February 18, 2017 This is a tutorial to guide you through the shiny new pkgcomp 2.0 on NetBSD. Goals: to use pkgcomp 2.0 to build a binary repository of all the packages you are interested in to keep the repository fresh on a daily basis and to use that repository with pkgin to maintain your NetBSD system up-to-date and secure. This tutorial is specifically targeted at NetBSD but should work on other platforms with some small changes. Expect, at the very least, a macOS-specific tutorial as soon as I create a pkgcomp standalone installer for that platform. Getting started First install the sysutilssysbuild-user package and trigger a full build of NetBSD so that you get usable release sets for pkgcomp. See sysbuild(1) and pkginfo sysbuild-user for details on how to do so. Alternatively, download release sets from the FTP site and later tell pkgcomp where they are. Then install the pkgtoolspkgcomp-cron package. The rest of this tutorial assumes you have done so. Adjusting the configuration To use pkgcomp for periodic builds, youll need to do some minimal edits to the default configuration files. The files can be found directly under varpkgcomp. which is pkgcomp-cron s home: varpkgcomppkgcomp. conf. This is pkgcomps own configuration file and the defaults installed by pkgcomp-cron should be good to go. The contents here are divided in three major sections: declaration on how to download pkgsrc, definition of the file system layout on the host machine, and definition of the file system layout for the built packages. You may want to customize the target system paths, such as LOCALBASE or SYSCONFDIR. but you should not have to customize the host system paths. varpkgcompsandbox. conf. This is the configuration file for sandboxctl. The default settings installed by pkgcomp-cron should suffice if you used the sysutilssysbuild-user package as recommended otherwise tweak the NETBSDNATIVERELEASEDIR and NETBSDSETSRELEASEDIR variables to point to where the downloaded release sets are. varpkgcompextra. mk. conf. This is pkgsrcs own configuration file. In here, you should configure things like the licenses that are acceptable to you and the package-specific options youd like to set. You should not configure the layout of the installed files (e. g. LOCALBASE ) because thats handled internally by pkgcomp as specified in pkgcomp. conf . varpkgcomplist. txt. This determines the set of packages you want to build in your periodic cron job. The builds will fail unless you list at least one package. WARNING: Make sure to include pkgcomp-cron and pkgin in this list so that your binary kit includes these essential package management tools. Otherwise youll have to deal with some minor annoyances after rebootstrapping your system. Lastly, review roots crontab to ensure the job specification for pkgcomp is sane. On slow machines, or if you are building many packages, you will probably want to decrease the build frequency from daily to weekly . Sample configuration Here is what the configuration looks like on my NetBSD development machine as dumped by the config subcommand. Use this output to get an idea of what to expect. Ill be using the values shown here in the rest of the tutorial: Building your own packages by hand Now that you are fully installed and configured, youll build some stuff by hand to ensure the setup works before the cron job comes in. The simplest usage form, which involves full automation, is something like this: This trivially-looking command will: checkout or update your copy of pkgsrc create the sandbox bootstrap pkgsrc and pbulk use pbulk to build the given packages and destroy the sandbox. After a successful invocation, youll be left with a collection of packages in the directory you set in PACKAGES. which in the default pkgcomp-cron installation is varpkgcomppackages . If youd like to restrict the set of packages to build during a manually-triggered build, provide those as arguments to auto. This will override the contents of AUTOPACKAGES (which was derived from your list. txt file). But what if you wanted to invoke all stages separately, bypassing auto. The command above would be equivalent to: Go ahead and play with these. You can also use the sandbox-shell command to interactively enter the sandbox. See pkgcomp(8) for more details. Lastly note that the root user will receive email messages if the periodic pkgcomp cron job fails, but only if it fails. That said, you can find the full logs for all builds, successful or not, under varpkgcomplog . Installing the resulting packages Now that you have built your first set of packages, you will want to install them. On NetBSD, the default pkgcomp-cron configuration produces a set of packages for usrpkg so you have to wipe your existing packages first to avoid build mismatches. WARNING: Yes, you really have to wipe your packages. pkgcomp currently does not recognize the package tools that ship with the NetBSD base system (i. e. it bootstraps pkgsrc unconditionally, including bmake ), which means that the newly-built packages wont be compatible with the ones you already have. Avoid any trouble by starting afresh. To clean your system, do something like this: Now, rebootstrap pkgsrc and reinstall any packages you previously had: Finally, reconfigure any packages where you had have previously made custom edits. Use the backup in rootetc. old to properly update the corresponding files in etc. I doubt you made a ton of edits so this should be easy. IMPORTANT: Note that the last command in this example includes pkgin and pkgcomp-cron. You should install these first to ensure you can continue with the next steps in this tutorial. Keeping your system up-to-date If you paid attention when you installed the pkgcomp-cron package, you should have noticed that this configured a cron job to run pkgcomp daily. This means that your packages repository under varpkgcomppackages will always be up-to-date so you can use that to quickly upgrade your system with minimal downtime. Assuming you are going to use pkgtoolspkgin (and why not), configure your local repository: And, from now on, all it takes to upgrade your system is: Lots of storage this week. February 17, 2017 After many (many) years in the making, pkgcomp 2.0 and its companion sandboxctl 1.0 are finally here Read below for more details on this launch. I will publish detailed step-by-step tutorials on setting up periodic package rebuilds in separate posts. What are these tools pkgcomp is an automation tool to build pkgsrc binary packages inside a chroot-based sandbox. The main goal is to fully automate the process and to produce clean and reproducible packages. A secondary goal is to support building binary packages for a different system than the one doing the builds: e. g. building packages for NetBSDi386 6.0 from a NetBSDamd64 7.0 host. The highlights of pkgcomp 2.0 . compared to the 1.x series, are: multi-platform support . including NetBSD, FreeBSD, Linux, and macOS use of pbulk for efficient builds management of the pkgsrc tree itself via CVS or Git and a more robust and modern codebase . sandboxctl is an automation tool to create and manage chroot-based sandboxes on a variety of operating systems . sandboxctl is the backing tool behind pkcomp. sandboxctl hides the details of creating a functional chroot sandbox on all supported operating systems in some cases, like building a NetBSD sandbox using release sets, things are easy but in others, like on macOS, they are horrifyingly difficult and brittle. Storytelling time pkgcomps history is a long one. pkgcomp 1.0 first appeared in pkgsrc on September 6th, 2002 as the pkgtoolspkgcomp package in pkgsrc. As of this writing, the 1.x series are at version 1.38 and have received contributions from a bunch of pkgsrc developers and external users even more, the tool was featured in the BSD Hacks book back in 2004. This is a long time for a shell script to survive in its rudimentary original form: pkgcomp 1.x is now a teenager at its 14 years of age and is possibly one of my longest-living pieces of software still in use. Motivation for the 2.x rewrite For many of these years, I have been wanting to rewrite pkgcomp to support other operating systems. This all started when I first got a Mac in 2005, at which time pkgsrc already supported Darwin but there was no easy mechanism to manage package updates. What would happenand still happens to this dayis that, once in a while, Id realize that my packages were out of date (read: insecure) so Id wipe the whole pkgsrc installation and start from scratch. Very inconvenient I had to automate that properly. Thus the main motivation behind the rewrite was primarily to support macOS because this was, and still is, my primary development platform. The secondary motivation came after writing sysbuild in 2012, which trivially configured daily builds of the NetBSD base system from cron I wanted the exact same thing for my packages. One, two no, three rewrites The first rewrite attempt was sometime in 2006, soon after I learned Haskell in school. Why Haskell Just because that was the new hotness in my mind and it seemed like a robust language to drive a pretty tricky automation process. That rewrite did not go very far, and thats possibly for the better: relying on Haskell would have decreased the portability of the tool, made it hard to install it, and guaranteed to alienate contributors. The second rewrite attempt started sometime in 2010, about a year after I joined Google as an SRE. This was after I became quite familiar with Python at work, wanting to use the language to rewrite this tool. That experiment didnt go very far though, but I cant remember why probably because I was busy enough at work and creating Kyua. The third and final rewrite attempt started in 2013 while I had a summer intern and I had a little existential crisis. The year before I had written sysbuild and shtk. so I figured recreating pkgcomp using the foundations laid out by these tools would be easy. And it was to some extent. Getting the barebones of a functional tool took only a few weeks, but that code was far from being stable, portable, and publishable. Life and work happened, so this fell through the cracks until late last year, when I decided it was time to close this chapter so I could move on to some other project ideas. To create the focus and free time required to complete this project, I had to shift my schedule to start the day at 5am instead of 7amand, many weeks later, the code is finally here and Im still keeping up with this schedule. Granted: this third rewrite is not a fancy one, but it wasnt meant to be. pkgcomp 2.0 is still written in shell, just as 1.x was, but this is a good thing because bootstrapping on all supported platforms is easy. I have to confess that I also considered Go recently after playing with it last year but I quickly let go of that thought: at some point I had to ship the 2.0 release, and 10 years since the inception of this rewrite was about time. The launch of 2.0 On February 12th, 2017, the authoritative sources of pkgcomp 1.x were moved from pkgtoolspkgcomp to pkgtoolspkgcomp1 to make room for the import of 2.0. Yes, the 1.x series only existed in pkgsrc and the 2.x series exist as a standalone project on GitHub . And here we are. Today, February 17th, 2017, pkgcomp 2.0 saw the light Why sandboxctl as a separate tool sandboxctl is the supporting tool behind pkgcomp, taking care of all the logic involved in creating chroot-based sandboxes on a variety of operating systems. Some are easy, like building a NetBSD sandbox using release sets, and others are horrifyingly difficult like macOS. In pkgcomp 1.x, this logic used to be bundled right into the pkgcomp code, which made it pretty much impossible to generalize for portability. With pkgcomp 2.x, I decided to split this out into a separate tool to keep responsibilities isolated. Yes, the integration between the two tools is a bit tricky, but allows for better testability and understandability. Lastly, having sandboxctl as a standalone tool, instead of just a separate code module, gives you the option of using it for your own sandboxing needs. I know, I know the world has moved onto containerization and virtual machines, leaving chroot-based sandboxes as a very rudimentary thing but thats all weve got in NetBSD, and pkgcomp targets primarily NetBSD. Note, though, that because pkgcomp is separate from sandboxctl, there is nothing preventing adding different sandboxing backends to pkgcomp. Installation Installation is still a bit convoluted unless you are on one of the tier 1 NetBSD platforms or you already have pkgsrc up and running. For macOS in particular, I plan on creating and shipping a installer image that includes all of pkgcomp dependenciesbut I did not want to block the first launch on this. For now though, you need to download and install the latest source releases of shtk. sandboxctl. and pkgcomp in this order pass the --with-atfno flag to the configure scripts to cut down the required dependencies. On macOS, you will also need OSXFUSE and the bindfs file system. If you are already using pkgsrc, you can install the pkgtoolspkgcomp package to get the basic tool and its dependencies in place, or you can install the wrapper pkgtoolspkgcomp-cron package to create a pre-configured environment with a daily cron job to run your builds. See the packages MESSAGE (with pkginfo pkgcomp-cron ) for more details. Documentation Both pkgcomp and sandboxctl are fully documented in manual pages. See pkgcomp(8). sandboxctl(8). pkgcomp. conf(5) and sandbox. conf(5) for plenty of additional details. As mentioned at the beginning of the post, I plan on publishing one or more tutorials explaining how to bootstrap your pkgsrc installation using pkgcomp on, at least, NetBSD and macOS. ترّقب. And, if you need support or find anything wrong, please let me know by filing bugs in the corresponding GitHub projects: jmmvpkgcomp and jmmvsandboxctl . February 16, 2017 I claim an IPv6 address using ifconfig in a script. This address is then immediately used to listen on a TCP port. When I write the script like this, it fails because the service is unable to listen: However, it succeeds when I do it like this: I tried writing the output of ifconfig directly after running the add - operation. It appears that ifconfig reports the IP-address as being tentative . which apparently prevents a service from listening on it. Naturally, waiting exactly one second and hoping that the address has become available is not a very good way to handle this. How can I wait for a tentative address to become available, or make ifconfig return later so that the address is all set up I finally registered, have been reading the forum for years. Ill simply copy this from LQ. Already have written to a couple of lists (including netbsd-users) but without results. Running 7.0.2 with out of the box kernel. All my GTK2 apps segfault on keyboard input. lxappearance for example, when looking for a theme you can start pressing keys and it will search. But in my case it dumps core with usrliblibpthread. so.1 . usrliblibc. so.12 and usrpkgliblibXcursor. so.1 . The same thing happens when typing something into a GTK2 text editor, leafpad, or looking for something in CtrlO window in firefox or gimp or any other programme. gimp cant even run inside gdb because of: Program received signal SIGTRAP, Tracebreakpoint trap. 0x00007f7fea49f6aa in lwppark60 () from usrliblibc. so.12 (gdb) bt 0 0x00007f7fea49f6aa in lwppark60 () from usrliblibc. so.12 1 0x00007f7fec808f2b in pthreadcondtimedwait () from usrliblibpthread. so.1 2 0x00007f7feb880b80 in gcondwait () from usrpkgliblibglib-2.0.so.0 3 0x00007f7feb81d7cd in gasyncqueuepopinternunlocked () from usrpkgliblibglib-2.0.so.0 4 0x00007f7feb86742f in gthreadpoolthreadproxy () from usrpkgliblibglib-2.0.so.0 5 0x00007f7feb866a7d in gthreadproxy () from usrpkgliblibglib-2.0.so.0 6 0x00007f7fec80a9cc in. () from usrliblibpthread. so.1 7 0x00007f7fea483de0 in. () from usrliblibc. so.12 8 0x0000000000000000 in. () Firefox also has problems in libc. so.12 and libpthread. so.1 but doesnt say about lwppark60. It also cant run inside gdb. lxappearance also dumps core when clicking Apply after changing something (themes, cursor or icon themes, fonts etc.) with another output: 0 0x00007f7fefcb27ba in. () from usrliblibc. so.12 1 0x00007f7fefcb2bc7 in malloc () from usrliblibc. so.12 2 0x00007f7ff1849782 in gmalloc () from usrpkgliblibglib-2.0.so.0 3 0x00007f7ff185ef1c in gmemdup () from usrpkgliblibglib-2.0.so.0 4 0x00007f7ff18356b8 in ghashtableinsertnode () from usrpkgliblibglib-2.0.so.0 5 0x00007f7ff1835823 in ghashtableinsertinternal () from usrpkgliblibglib-2.0.so.0 6 0x00007f7ff183ccb1 in gkeyfileflushparsebuffer () from usrpkgliblibglib-2.0.so.0 7 0x00007f7ff183cf62 in gkeyfileparsedata () from usrpkgliblibglib-2.0.so.0 8 0x00007f7ff183d0e1 in gkeyfileloadfromfd () from usrpkgliblibglib-2.0.so.0 9 0x00007f7ff183d99e in gkeyfileloadfromfile () from usrpkgliblibglib-2.0.so.0 10 0x0000000000405532 in start () Apart from these programmes I receive SIGILL in mplayer when trying to play videos. Backtrace doesnt tell anything useful. sxiv, an image viewer, segfaults with this: 0 0x00007f7ff64b209f in. () from usrliblibc. so.12 1 0x00007f7ff64b3983 in free () from usrliblibc. so.12 2 0x000000000040729c in removefile () 3 0x0000000000409a92 in main () Previously, if built from local pkgsrc tree it worked but now stopped working at all at all. mpg321 dumps core and says Memory fault with this backtrace: 0 0x00007f7ff78068b1 in sempost () from usrliblibpthread. so.1 1 0x000000000040afe0 in. () 2 0x0000000000403695 in. () 3 0x00007f7ff7ffa000 in. () 4 0x0000000000000002 in. () 5 0x00007f7ffffffdb0 in. () 6 0x00007f7ffffffdb7 in. () 7 0x0000000000000000 in. () I did memtests, once for four hours (two passes) and once for eight hours (eight passes). I did Dells ePSA tests (diagnostic utility accessed from BIOS), it has own memtest, apart from monitoring the hard drive, the power supply, the keyboard, the fans, the CPU all of them returned no errors. I rebuilt gtk2 with debug symbols but it changed nothing. On LQ it was suggested that I have hardware problems, but I am not convinced. Every programme described above worked inside Ubuntu LiveUSB and Void Linux LiveUSB on the same machine (picked because they have different libcs). Before I had NetBSD with X11 a couple of months ago (and earlier) and I didnt have these errors. In the Interwebs I found similar messages on Arch forum and Launchpad. Is there a need for a 24 hour memtest Should I just remove each of the two memory modules and try Is it hardware related after all Thanks everyone for any kind of help. February 14, 2017 The LLVM project is a quickly moving target, this also applies to the LLVM debugger -- LLDB. Its actively used in several first-class operating systems, while - thanks to my spare time dedication - NetBSD joined the LLDB club in 2014, only lately the native support has been substantially improved and the feature set is quickly approaching the support level of Linux and FreeBSD. During this work 12 patches were committed to upstream, 12 patches were submitted to review, 11 new ATF were tests added, 2 NetBSD bugs filed and several dozens of commits were introduced in pkgsrc-wip, reducing the local patch set to mostly Native Process Plugin for NetBSD. What has been done in NetBSD 1. Triagged issues of ptrace(2) in the DTraceNetBSD support Chuck Silvers works on improving DTrace in NetBSD and he has detected an issue when tracer signals are being ignored in libproc . The libproc library is a compatibility layer for DTrace simulating proc capabilities on the SunOS family of systems. Ive verified that the current behavior of signal routing is incorrect. The NetBSD kernel correctly masks signals emitted by a tracee, not routing them to its tracer. On the other hand the masking rules in the inferior process blacklists signals generated by the kernel, which is incorrect and turns a debugger into a deaf listener. This is the case for libproc as signals were masked and software breakpoints triggering INT3 on i386 amd64 CPUs and SIGTRAP with TRAPBRKP sicode wasnt passed to the tracer. This isnt limited to turning a debugger into a deaf listener, but also a regular execution of software breakpoints requires: rewinding the program counter register by a single instruction, removing trap instruction and restoring the original instruction. When an instruction isnt restored and further code execution is pretty randomly affected, it resulted in execution anomalies and breaking of tracee. A workaround for this is to disable signal masking in tracee. Another drawback inspired by the DTrace code is to enhance PTSYSCALL handling by introducing a way to distinguish syscall entry and syscall exit events. Im planning to add dedicated sicodes for these scenarios. While there, there are users requesting PTSTEP and PTSYSCALL tracing at the same time in an efficient way without involving heuristcs. Ive filed the mentioned bug: Ive added new ATF tests: Verify that masking single unrelated signal does not stop tracer from catching other signals Verify that masking SIGTRAP in tracee stops tracer from catching this raised signal Verify that masking SIGTRAP in tracee does not stop tracer from catching software breakpoints Verify that masking SIGTRAP in tracee does not stop tracer from catching single step trap Verify that masking SIGTRAP in tracee does not stop tracer from catching exec() breakpoint Verify that masking SIGTRAP in tracee does not stop tracer from catching PTRACEFORK breakpoint Verify that masking SIGTRAP in tracee does not stop tracer from catching PTRACEVFORK breakpoint Verify that masking SIGTRAP in tracee does not stop tracer from catching PTRACEVFORKDONE breakpoint Verify that masking SIGTRAP in tracee does not stop tracer from catching PTRACELWPCREATE breakpoint Verify that masking SIGTRAP in tracee does not stop tracer from catching PTRACELWPEXIT breakpoint 2. EL F Auxiliary Vectors The ELF file format permits to transfer additional information for a process with a dedicated container of properties, its named ELF Auxilary Vector . Every system has its dedicated way to read this information in a debugger from a tracee. The NetBSD approach is to transfer this vector with a ptrace (2) API PIODREADAUXV . Our interface shares the API with OpenBSD. I filed a bug that our interface returns vector size of 8496 bytes, while OpenBSD has constant 64 bytes. It was diagnosed and fixed by Christos Zoluas that we were incorrectly counting bits and bytes and this enlarged the data streamlined. The bug was harmless and had no known side-effects besides large chunk of zeroed data. There is also a prepared local patch extending NetBSD platform support to read information for this vector, its primarily required for correct handling of PIE binaries. At the moment there is no interface similar to info auxv to the one from GDB. Unfortunately at the current stage, this code is still unused by NetBSD. I will return to it once the Native Process Plugin is enhanced. Ive filed the mentioned bug: Ive added new ATF test: Verify PTREADAUXV called for tracee . What has been done in LLDB 1. Resolving executables name with sysctl(7) In the past the way to retrieve a specified process executable path name was using Linux-compatibile feature in procfs ( proc ). The canonical solution on Linux is to resolve path of procPIDexe . Christos Zoulas added in DTrace port enhancements a solution similar to FreeBSD to retrieve this property with sysctl (7). This new approach removes dependency on proc mounted and Linux compatibility functionality. Support for this has been submitted to LLDB and merged upstream: 2. Real-Time Signals The key feature of the POSIX standard with Asynchronous IO is to support Real-Time Signals. One of their use-cases is in debugging facilities. Support for this set of signals was developed during Google Summer of Code 2016 by Charles Cui and reviewed and committed by Christos Zoulas. Ive extended the LLDB capabilities for NetBSD to recognize these signals in the NetBSDSignals class. Support for this has been submitted to LLDB and merged upstream: 3. Conflict removal with system-wide six. py The transition from Python 2.x to 3.x is still ongoing and will take a while. The current deadline support for the 2.x generation has been extended to 2020. One of the ways to keep both generations supported in the same source-code is to use the six. py library (py2 x py3 6.py). It abstracts commonly used constructs to support both language families. The issue for packaging LLDB in NetBSD was to install this tiny library unconditionally to a system-wide location. There were several solutions to this approach: drop Python 2.x support, install six. py into subdirectory, make an installation of six. py conditional. The first solution would turn discussion into flamewar, the second one happened to be too difficult to be properly implemented as the changes were invasive and Python is used in several places of the code-base (tests, bindings. ). The final solution was to introduce a new CMake option LLDBUSESYSTEMSIX - disabled by default to retain the current behavior. To properly implement LLDBUSESYSTEMSIX . I had to dig into installation scripts combined in CMake and Python files. It wasnt helping that Python scripts were reinventing getopt (3) functionality. and I had to alter it in order to introduce a new option --useSystemSix . Support for this has been submitted to LLDB and merged upstream: 4. Do not pass non-POD type variables through variadic function There was a long standing local patch in pkgsrc, added by Tobias Nygren and detected with Clang. According to the C11 standard 5.2.27: Passing a potentially-evaluated argument of class type having a non-trivial copy constructor, a non-trivial move constructor, or a non-trivial destructor, with no corresponding parameter, is conditionally-supported with implementation-defined semantics. A short example to trigger similar warning was presented by Joerg Sonnenberg: This code compiled against libc gives: Support for this has been submitted to LLDB and merged upstream: 5. Add NetBSD support in Host::GetCurrentThreadID Linux has a very specific thread model, where process is mostly equivalent to native thread and POSIX thread - its completely different on other mainstream general-purpose systems. That said fallback support to translate pthreadt on NetBSD to retrieve the native integer identifier was incorrect. The proper NetBSD function to retrieve light-weigth process identification is to call lwpself (2). Support for this has been submitted to LLDB and merged upstream: 6. Synchronize PlatformNetBSD with Linux The old PlatformNetBSD code was based on the FreeBSD version. While the FreeBSD current one is still similar to the one from a year ago, its inappropriate to handle a remote process plugin approach. This forced me to base refreshed code on Linux. After realizing that PlatformPlugin on POSIX platforms suffers from code duplication, Pavel Labath helped out to eliminate common functions shared by other systems. This resulted in a shorter patch synchronizing PlatformNetBSD with Linux, this step opened room for FreeBSD to catch up. Support for this has been submitted to LLDB and merged upstream: 7. Transform ProcessLauncherLinux to ProcessLauncherPosixFork It is UNIX specific that signal handlers are global per application. This introduces issues with wait (2)-like functions called in tracers, as these functions tend to conflict with real-life libraries, notably GUI toolkits (where SIGCHLD events are handled). The current best approach to this limitation is to spawn a forkee and establish a remote connection over the GDB protocol with a debugger frontend. ProcessLauncherLinux was prepared with this design in mind and I have added support for NetBSD. Once FreeBSD will catch up, they might reuse the same code. Support for this has been submitted to LLDB and merged upstream: reviews. llvm. orgD29347 - Add ProcessLauncherNetBSD to spawn a tracee renamed to Transform ProcessLauncherLinux to ProcessLauncherPosixFork committed r293768 8. Document that LaunchProcessPosixSpawn is used on NetBSD Host::GetPosixspawnFlags was built for most POSIX platforms - however only Apple, Linux, FreeBSD and other-GLIBC ones (I assume DebiankFreeBSD to be GLIBC-like) were documented. Ive included NetBSD to this list. Support for this has been submitted to LLDB and merged upstream: Document that LaunchProcessPosixSpawn is used on NetBSD committed r293770 9. Switch std::callonce to llvm::callonce There is a long-standing bug in libstdc on several platforms that std::callonce is broken for cryptic reasons. This motivated me to follow the approach from LLVM and replace it with homegrown fallback implementation llvm::callonce . This change wasnt that simple at first sight as the original LLVM version used different semantics that disallowed straight definition of non - static onceflag . Thanks to cooperation with upstream the proper solution was coined and LLDB now works without known regressions on libstdc out-of-the-box. Support for this has been submitted to LLVM, LLDB and merged upstream: 10. Other enhancements I a had plan to push more code in this milestone besides the mentioned above tasks. Unfortunately not everything was testable at this stage. Among the rescheduled projects: In the NetBSD platform code conflict removal in GetThreadName SetThreadName between pthreadt and lwpidt . It looks like another bite from the Linux thread model. Proper solution to this requires pushing forward the Process Plugin for NetBSD. Host::LaunchProcessPosixSpawn proper setting ::posixspawnattrsetsigdefault on NetBSD - currently untestable. Fix false positives - premature before adding more functions in NetBSD Native Process Plugin. On the other hand Ive fixed a build issue of one test on NetBSD: Plan for the next milestone Ive listed the following goals for the next milestone. mark exect (3) obsolete in libc remove libpthreaddbg (3) from the base distribution add new API in ptrace (2) PTSETSIGMASK and PTGETSIGMASK add new API in ptrace (2) to resume and suspend a specific thread finish switch of the PTWATCHPOINT API in ptrace (2) to PTGETDBREGS amp PTSETDBREGS validate i386, amd64 and Xen proper support of new interfaces upstream to LLDB accessors for debug registers on NetBSDamd64 validate PTSYSCALL and add a functionality to detect and distinguish syscall-entry syscall-exit events validate accessors for general purpose and floating point registers Post mortem FreeBSD is catching up after NetBSD changes, e. g. with the following commit: This move allows to introduce further reduction of code-duplication. There still is a lot of room for improvement. Another benefit for other software distributions, is that they can now appropriately resolve the six. py conflict without local patches. These examples clearly show that streamlining NetBSD code results in improved support for other systems and creates a cleaner environment for introducing new platforms. A pure NetBSD-oriented gain is improvement of system interfaces in terms of quality and functionality, especially since DTraceNetBSD is a quick adopter of new interfaces. and indirectly a sandbox to sort out bugs in ptrace (2). The tasks in the next milestone will turn NetBSDs ptrace (2) to be on par with Linux and FreeBSD, this time with marginal differences. To render it more clearly NetBSD will have more interfaces in readwrite mode than FreeBSD has (and be closer to Linux here), on the other hand not so many properites will be available in a thread specific field under the PTLWPINFO operation that caused suspension of the process. Another difference is that FreeBSD allows to trace only one type of syscall events: on entry or on exit. At the moment this is not needed in existing software, although its on the longterm wishlist in the GDB project for Linux. It turned out that, I was overly optimistic about the feature set in ptrace (2), while the basic ones from the first milestone were enough to implement basic support in LLDB. it would require me adding major work in heuristics as modern tracers no longer want to perform guessing what might happened in the code and what was the source of signal interruption. This was the final motivation to streamline the interfaces for monitoring capabilities and now Im adding remaining interfaces as they are also needed, if not readily in LLDB, there is DTrace and other software that is waiting for them now. Somehow I suspect that I will need them in LLDB sooner than expected. This work was sponsored by The NetBSD Foundation. The NetBSD Foundation is a non-profit organization and welcomes any donations to help us continue to fund projects and services to the open-source community. Please consider visiting the following URL, and chip in what you can: February 09, 2017 We became tired of waiting. File Info: 7Min, 3MB. Ogg Link: archive. orgdownloadbsdtalk266bsdtalk266.ogg February 08, 2017 Background I am using a sparc64 Sun Blade 2500 (silver) as a desktop machine - for my pretty light desktop needs. Besides the usual developer tools (editors, compilers, subversion, hg, git) and admin stuff (all text based) I need mpg123 and mserv for music queues, Gimp for image manipulation and of course Firefox. Recently I updated all my installed pkgs to pkgsrc-current and as usual the new Firefox version failed to build. Fortunately the issues were minor, as they all had been handled upstream for Firefox 52 already, all I needed to do was back-porting a few fixes. This made the pkg build, but after a few minutes of test browsing, it crashed. Not surprisingly this was reproducible, any web site trying to play audio triggered it. A bit surprising though: the same happened on an amd64 machine I tried next. After a bit digging the bug was easy to fix, and upstream already took the fix and committed it to the libcubeb repository. So I am now happily editing this post using Firefox 51 on the Blade 2500. I saw one crash in two days of browsing, but unfortunately could not (yet) reproduce it (I have gdb attached now). There will be future pkg updates certainly. Future Obstacles You may have read elsewhere that Firefox will start to require a working Rust compiler to build. This is a bit unfortunate, as Rust (while academically interesting) is right now not a very good implementation language if you care about portability. The only available compiler requires a working LLVM back end, which we are still debugging. Our auto-builds produce sparc sets with LLVM, but the result is not fully working (due to what we believe being code gen bugs in LLVM). It seems we need to fix this soon (which would be good anyway, independent of the Rust issue). Besides the back end, only very recently traces of sparc64 support popped up in Rust. However, we still have a few firefox versions time to get it all going. I am optimistic. Another upcoming change is that Cairo (currently used as 2D graphics back end, at least on sparc64) will be phased out and Skia will be the only supported software rendering target. Unfortunately Skia does (as of now) not support any big endian machine at all. I am looking for help getting Skia to work on big endian hardware in general, and sparc64 in particular. Alternatives Just in case, I tested a few other browsers and (so far) they all failed: NetSurf Nice, small, has a few tweaks and does not yet support JavaScript good enough for many sites MidoriThey call it lightweight but it is based on WebKit, which alone is a few times more heavy than all of Firefox. It crashes immediately at startup on sparc64 (I am investigating, but with low priority - actually I had to replace the hard disk in my machine to make enough room for the debug object files for WebKit - it takes So, while it is a bit of a struggle to keep a modern browser working on my favorite odd-ball architecture, it seems we will get at least to the Firefox 52 ESR release, and that should give us enough time to get Rust working and hopefully continue with Firefox. February 07, 2017 So finally Ive moved all services from my old server to my Christmas Xen box. This was not without problems due to the fact it had to run NetBSD - current gcc toolchain is broken for some packages which affected running any PHP build clang toolchain was broken for my config (USESSP yes and . February 04, 2017 Note the end this week of pc98, the most focused of niche platforms. January 31, 2017 What has been done in NetBSD What has been done in LLDB Plan for the next milestone Accidental theme this week: books. What are the techniques generally people follow to dump full core dump if the size of core dump is more than the RAM and flash. Say, kernel core is of 2GB size but we have exactly 2GB of RAM and 1GB of disk space. I am aware external USB and tftp options. But, reliability and stability matters when we choose these options. How do embedded people handle these type of issues and what are the techniques available Platform: NetBSD, ARM7 January 18, 2017 Previously This is the sixth in a series of Nifty and Minimally Invasive qmail Tricks, following Losing services (and eventually restoring them) When my Mac mini s hard drive died in the Great Crash of Fall 2008. taking this website and my email offline with it, I was already going through a rough time, and my mental bandwidth was extremely limited. I expended some of it explaining to friends what they could do about their hosted domains until such time as my brain became available again (as I assumed andor hoped it eventually would). I expended a bit more asking a friend to do a small thing to keep my email flowing somewhere I could get it. And then I was spent. The years where I used Gmail and had no website felt like years in the wilderness. That feeling could mostly have been about how I missed the habit of reflecting about my life now and again, writing about it, and sharing. But when the website returned four years ago (in order to remember Aaron Swartz ), the feeling didnt go away. All I got was a small sense of relief that my writings and recordings were available and that I could safely revive my old habit. After a year and half of reflecting, writing, and sharing, the feels-needle hadnt rebounded much further. It was only after painstakingly restoring all my old email (from Mail. apps cache, using emlx2maildir ), moving it up to my IMAP server, carefully merging six years worth of Gmail into that, accepting SMTP deliveries for schmonz. and not needing Gmail at all for several weeks that I noticed my long, strange sojourn had ended. Hypothetically speaking If it so happened that Id instead fixed email first, Id also have felt a tiny bit weird till my website was back. But only a tiny bit. When my web servers down, you might not hear from me when my mail servers down, I cant hear from you or, as happened in 2008, from my professors during finals week. So while web hosting can be interesting. mail hosting keeps me attached to what it feels like to be responsible for a production service. Keeping it real I value this firsthand understanding very, very highly. I started as a sysadmin, Im often still a developer, and thats part of why Im sometimes helpful to others. But since Im always in danger of forgetting lessons I learned by doing it, Im always in danger of being harmful when I try to help others do it . As a coach, one of my meta-jobs is to remind myself what it takes to know the risks, decide to ship it, live with the consequences, tighten the shipping-it loop until its tight enough, and notice when that stops being true. And thats why I run my own mail server. Whats new this week My 2014 mail server was configured just about identically with my 2008 one, for which it was handy to consult the earlier articles in this series . Then, recently, my weekly build broke on the software Ive been using to send mail. It was a trivial breakage, easy to fix, but it reminded me about a non-trivial future risk that I didnt want hanging over my head anymore. (For more details, see my previous post .) Now Im sending mail another way. Clients are unchanged, the server no longer needs TMDA or its dependencies, and I no longer have a specific expectation for how this aspect of my mail service will certainly break in the future. (Just some vague guesses, like a newly discovered compromise in the TLS protocol or OpenSSLs implementation thereof, or STARTTLS or Stunnel s implementation thereof.) A couple iterations First, I tried the smallest change that might work: Replacing tmda-ofmipd with the original ofmipd from mess822 (by the author of qmail. the software around which my mail service is built), Wrapped in SMTP AUTH by spamdyke (new use of an existing tool), Wrapped in STARTTLS by stunnel (as before). It worked TMDA no longer needed. I committed an update to my qmail-run package with a new shell script to manage this ofmipd service. uninstalled TMDA, and removed its configuration files. Next, I tried a change that might shorten the chain of executables : It worked Second instance of spamdyke no longer needed. To start a mail submission service on localhost port 26, these are the lines I added to etcrc. conf : To make the service available on the network, this is the config from etcstunnelstunnel. conf : (It already had this stanza, but with 8025 where tmda-ofmipd was listening. I simply changed the port number and restarted stunnel .) Im still relying on spamdyke for other purposes, but Im comfortable with those. Im still relying on stunnel for STARTTLS, but Im relatively comfortable keeping OpenSSL contained in its own address space and user account. Refactoring for mail hosting The present configuration is a refactoring. no externally visible change to email clients, yes internally visible change to email administrator (moi). I believe this refactoring was one of the best kind, able to be performed safely and reducing the risk I was worried about. The current configuration is much more likely to meet my future need to not have a production outage that interrupts my work for arbitrary duration while I scramble to understand and fix it. I dont have any more cheap ideas for lowering my risk, and it feels low enough anyway. So Im comfortable that this is the right place to stop . Conclusion Want to learn to see the consequences of your choices andor help other people do the same Consider productionizing something important to you. January 14, 2017 Im trying to compile a program with clang and libc on NetBSD. Clang version is 3.9.0, and NetBSD version is 7.0.2. The compile is failing with: ltcstddefgt is present, but it appears to be GCCs: If I am parsing Index of pubNetBSDNetBSD-release-7srcexternalbsdlibc correctly, the library is available. When I attempt to install libc or libcxx : Is Clang with libc a supported configuration on NetBSD How do we use Clang and libc on NetBSD January 11, 2017 Ill install netbsd on an old computer, but I am sure Ill have a hard time to get wireless internet working in a way or another. I figured I could do that easily if I managed to install things for this computer, on another one, the one I am using now, by crosscompiling. And that it would be a good training, isnt it For now, if pkgadd and so on are recognized, I still cant pkgadd pkgin or any software: it says it doesnt know that package. How come. I see it, its there. شكر. Heres my PATH variable: PATHusrpkgsbin:usrpkgbin:usrlocalbin:usrbin:bin:usrlocalgames:usrgames ps:some might remember me. Indeed, I failed using this system many time, but I am a romantic, and I cant stop feeling something in my heart anytime I read pkgsrc or netbsd, I just dont know why. so here I am again :D January 09, 2017 NetBSDs scheduler was recently changed to better distribute load of long-running processes on multiple CPUs. So far, the associated sysctl tweaks were not documented, and this was changed now, documenting the kern. sched sysctls. For reference, here is the text that was added to the sysctl(7) manpage. Well, subject says it all. To quote from Soren Jacobsens email. The first release candidate of NetBSD 7.1 is now available for download at: Those of you who prefer to build from source can continue to follow the netbsd-7 branch or use the netbsd-7-1-RC1 tag. There have been quite a lot of changes since 7.0. See srcdocCHANGES-7.1 for the full list. Please help us out by testing 7.1RC1. We love any and all feedback. Report problems through the usual channels (submit a PR or write to the appropriate list). More general feedback is welcome at email160protected Ive installed NetBSD 7.0.1 in a KVM virtual machine under libvirt on a Fedora 25 Linux host. I want to use spice. so i specified the requisite qxl graphic in the virtual machine then installed xf86-video-qxl-0.1.4nb1 with pkgin in the NetBSD guest. But both varlogxdm. log and varlogXorg.0.log complained that they couldnt find the qxl module. Then I realized they were looking in usrX11R7libmodules but the qxl package put it in usrpkglibxorgmodules. To solve that, I manually added a symbolic link. And indeed, that solved the not found problem. (But why the two directories. ) Now they complain that its the wrong driver. Both xdm. log and Xorg.0.log gripe: (EE) module ABI major version (20) doesnt match the servers version (10) (EE) Failed to load module qxl (module requirement mismatch, 0) Why are things out of sync in the NetBSD code base How can anyone get X to work What can I do to solve this January 08, 2017 im trying to install nzbget. i think it was in the pkgsrc way back but its not there anymore. so i tried this: (1) i downloaded the source from nzbget website (2) then. configure said A compiler with support for C14 language features is required.. so i installed gcc6 using pkgin in gcc6 (3) so then i tried PATHusrpkggcc6bin:PATH. configure and it said compiler is ok, but now i got configure: error: ncurses library not found (4) i have ncurses lib in usrpkgincludencurses, how to let. configure know the location of ncurses lib Is it normal that when I use Zlib from Pkgsrc or base as reference via include bl3 for a project (like the current supertuxkart version 0.9.2) that within. buildlinkinclude directory no symlinks exist of zlib. h and zconf. h I newer saw this behaviour before and it breaks the compilation. January 05, 2017 Last night, mere moments from letting me commit a new package of Test::Continuous (continuous testing for Perl), my computer acted as though it knew its replacement was on the way and didnt care to meet it. This tiny mid-2013 11 MacBook Air made it relatively ergonomic to work from planes, buses, and anywhere else when I lived in New York and flew regularly to see someone important in Indiana, and continued to serve me well when that changed and changed again . The next thing I was planning to do with it was write this post. Instead I rebooted into DiskWarrior and crossed my fingers. Things get in your way, or threaten to. Thats life. But when you have slack time. you can Cope better when stuff happens, Invest in reducing obstacles, and Feel more prepared for the next time stuff happens. Having enough slack is as virtuous a cycle as insufficient slack is a vicious one. Paying down non-tech debts Last year I decided to spend more time and energy improving my health. Having recently spent a few weeks deliberately not paying attention to any of that, Im quite sure that I prefer paying attention to it, and am once again doing so. Learning to make my health a priority required that I make other things non-priorities, notably Agile in 3 Minutes. It no longer requires that. Ive recently invested in making the site easier for me to publish, and you may notice that its easier for you to browse. I didnt have enough slack to do these things when I was writing and recording a new episode every week. Now that enough of them have been taken care of, I feel prepared to take new steps with the podcast. And tech debts Earlier this week I noticed a broken link in a comment on Refactorings for web hosting. so I took a moment to check for other broken links on this site (ikiwiki makes it easy ). Before that, I inspected and minimized the differences between dev (my laptop) and prod (my server, where youre reading this), updated prod with the latest ikiwiki settings, and (because its all in Git) rebased dev from prod. In so doing, I observed that more config differences could be easily harmonized by adjusting some server paths to match those on my laptop. (When Apple introduced System Integrity Protection. pkgsrc on Mac OS X could no longer install under usr. and moved to opt. With my automated NetBSD package build. I can easily build the next batch for optpkg as well, retaining usrpkg as a symlink for a while. So I have.) Ive been running lots of these builds in the past week anyway, because a family of packages I maintain in pkgsrc had been outdated for quite a while and I finally got around to catching them up to upstream. Once they built on OS X, I committed the updates to the cross-platform package system. only to notice that at least one of them didnt build on NetBSD. So I fixed it, ran another build, saw what else I broke, and repeated until green. And taking on patience debt telling you about more of this crud Due to another update that temporarily broke the build of TMDA. I was freshly reminded that thats a relatively biggish liability in my server setup. I use TMDA to send mail. which is not mainly what its for, and I never got around to using it for what its for (protecting against spam with automated challenge-response), and it hasnt been maintained for years, and is stuck needing an old version of Python. On the plus side, running a weekly build means that when TMDA breaks more permanently, Ill notice pretty quickly. On the minus side, when that happens, Ill feel pressure to fix or replace it so I can (1) continue to send email like a normal person and (2) restart the weekly build like a me-person. If I can reduce the liability now, maybe I can avoid feeling that pressure later. Investigating alternatives, I remembered that Spamdyke. which I already use for delaying the SMTP greeting. blacklisting from a DNSBL as well as To: addresses that only get spam anymore, and greylisting from unknown senders, can provide SMTP AUTH. So Ill try keeping stunnel and replacing tmda-ofmipd with a second instance of spamdyke. If thats good, Ill remove mailtmda from the list of packages I build every week. then build spamdyke with OpenSSL support and try letting it handle the TLS encryption directly. If thats good, Ill remove securitystunnel from the list of packages too, leaving me at the mercy of fewer pieces of software breaking. Leaning more heavily on Spamdyke isnt a clear net reduction of risk. When a bad bug is found, itll impact several aspects of my mail service. And if and when NetBSD moves from GCC to Clang, Ill have to add langgcc to my list of packages and instruct pkgsrc to use it when building Spamdyke, or else come up with a patch to remove Spamdykes use of anonymous inner functions in C. (That could be fun. I recently started learning C .) I could go on, but Im a nice person who cares about you. Thats enough of that. So what All these builds pushing my soon-to-be-replaced laptop through its final paces as a development machine might have had something to do with triggering its misbehavior last night. And all this work seems like, well, a lot of work. Is there some way I could do less of it Yes, of course. But given my interests and goals, it might not be a clear net improvement. For instance, when Tim Ottinger drew my attention to that Test::Continuous Perl module, being a pkgsrc developer gave me an easy way to uninstall it if I wound up not liking it, which meant it was easy to try, which meant I tried it. I want conditions in my life to favor trying things. So Im invested in preserving and extending those conditions. In Gary Bernhardt s formulation, Im aiming to maximize the area under the curve . No new resolutions, yes new resolvings Im not looking to add new goals for myself for 2017. Im not even trying to make existing things good enough there are too many things, and as a recovering perfectionist I have trouble setting a reasonable bar Im just trying to make them good enough enough that I can expect small slices of time and attention to permit small improvements . Jessica Kerr has a thoughtful side blog named True in software, true in life. Heres something thatd qualify: When conditions are expected to change, smaller batch size helps us adjust. Reducing batch size takes time and effort. Paying down my self-debts (technical and otherwise) feels like resolving . I have, at times, felt quite out of position at managing myself. Lately Im feeling much more in position, and much more like I can expect to continue to make small improvements to my positioning. When you want the option to change your bodys direction, you take smaller steps, lower your center, concentrate on balance. Thats Agile. Moi My current best understanding is that a balanced life is a small-batch-size life. If thats the case, Im getting there. Further repositioning This coming Monday, Ill be switching to one of these weird new MacBook Pros with the row of non-clicky touchscreen keys. If my current computer survives till then, thatll be one smooth step in a series of transitions. (In other news, Bekki defends her dissertation that day.) The following Monday, Ill be starting my next project, a mostly-remote gig pairing in Python to deliver software for a client while encouraging and supporting growth in my Pillar teammates. Ill be in Des Moines every so often if youre there andor have recommendations for me, Id love to hear from you. The Monday after that, well pack up a few things the movers havent already taken away, and our time in Indiana will come to an end. Were headed back to the New York area to live near family and friends. No resolutions, yes intentions For 2017, I declare my intentions to: Continue to improve my health and otherwise attend to my own needs Help more people understand what software development work is like Help more people feel heard I hope to see and hear you along the way. January 04, 2017 So over the holidays, I managed to get in some good quality family time and find some time to work on some Open Source stuff. I meant to work mainly on dhcpcd. but it turned out I spent most of my time working on NetBSD curses library so that Python Curses now works with it. Now, most people r. Adding and removing hardware components in operation is common in todays commoditized computing environments. This was not always the case - in the past century, one had to power down a machine in order to change network cards, harddisks or RAM. A major step towards changing a systems configuration at runtime for customers came with USB, but thats not where it ends - other systems like PCI support hotplugging as well. Another area where changing of the systems configuration is the amount of Ramdom Access Memory (RAM) of a system. Usually fixed, this is determined at system start time, and then managed by the operating systems memory managent system. But esp. with todays virtualized hardware systems, even the amount of RAM assigned to a system can easily be changed. For example a VM can be assigned more RAM when needed, without even rebooting the system, leading to increased system performance without introducing swappingpaging overhead. Of course this required support from the operating system and its memory management subsystem. For NetBSD, the UVM virtual memory system was now changed to support this via the uvmhotplug(9) API, and a first user for this is the Xen balloon(4) driver. Quoting from the balloon(4) manpage. The balloon driver supports the memory ballooning operations offered in Xen environments. It allows shrinking or extending a domains available memory by passing pages between different domains. The uvmhotplug(9) manpage gives us more information on the UVM hotplug functionality: When the kernel is compiled with options UVMHOTPLUG, memory segments are handled in a dynamic data structure (rbtree(3)) com - pared to a static array when not. This enables kernel code to add or remove information about memory segments at any point after boot - thus hotplug. To answer more questions for portmasters who want to change their ports, Cherry G. Mathew has now posted a uvmhotplug(9) port masters FAQ. It covers questions on the background, affected files, and needed changes. For more information on UVM, see Charles Chuck Cranors PhD disertation on Design and Implementation of UVM (PDF) as well as his Usenix talk on the UVM Virtual Memory System (PS). There is also plenty of information available on Xen ballooning - check it out and share your experiences on NetBSDs port-xen mailing list December 29, 2016 My brother got me some very tasty presents for Christmas (and my up-coming Birthday) . namely the GIGABYTE BRIX J1900 and a Samsung EVO 750 250G. Santa also brought me 8G of Crucial memory. Putting them all together is a nice new machine to install NetBSD Xen. The key part is this is a low. December 22, 2016 After my last blog postings on the NetBSD scheduler. some time went by. What has happened that the code to handle process migration was rewritten to give more knobs for tuning, and some testing was done. The initial problem state in PR kern51615 is solved by the code. To reach a wider audience and get more testing, the code was committed to NetBSD-current today. Now, two things remain to be seen: More testing . This best involved situations that compare the systems behaviour without and with the patch. Situations to test include pure computation jobs that involve multiple parallel processes a mix of CPU-crunching and inputoutput, again on a number of concurrent processes full build. sh examples If you have time and an interesting set of numbers, please feel free to let us know on tech-kern.. Documentation . There is already a number of undocumented sysctls under kern. sched, which was now extended by one more, averageweight. While its obvious to add the knob from the formula, testing it under various real-life conditions and see how things change is left to be determined by a PhD thesis or two - be sure to drop us your patches for srcsharemanman7sysctl.7 if you can come up with a comprehensible description of all the scheduler sysctls So just now when you thought there is no more research to be done in scheduling algorithms, here is your chance to fame and glory. -)December 17, 2016 How can I activate Keyboard Latin American on NetBSD Because when I am installing I never saw the Latin American keyboard, only Spanish. December 09, 2016 Where can I find and install an AR9271 driver for the latest NetBSD The target machine does not have Internet access and I need to setup the WiFi dongle first. UPDATE . wpasupplicant was already written, but I didnt see my device. When I plug in the dongle its shown as: ifconfig shows only re0 and lo0 interfaces. UPDATE . I saw on some Linux forums that the dongle uses an Atheros chip, but I checked in Windows and see Ralink. The ral driver is also integrated in NetBSD, but the situation doesnt change - I see no ra device in dmesg. boot. December 08, 2016 So, Ive installed NetBSD 7 and device shown again as ugen (ugein, lol). Then Im installed FreeBSD 10.2 and ugen again. usbconfig gives me ugen4.3: ltproduct 0x7601 vendor 0x148fgt at usbus4, cfg0 mdHOST spdHIGH(480Mbps) pwrON (90ma) So, whats next Buying new dongle is a last thing, which Ill make. UPD: NDIS driver not works. December 07, 2016 At Agile Testing Days. I facilitated a workshop called DevOps Dojo. We role-played Dev and Ops developing and operating a production system, then figured out how to do it better together. Youre welcome to use the workshop materials for any purpose, including your own workshop. If you do, Id love to hear about it. Some firsts Ive spoken at several instances of pkgsrcCon (including twice in nearby Berlin ), but thats more like a hackathon with some talks. Agile Testing Days was a proper conference . with hundreds of people and plenty of conferring. If someone asks whether Im an international speaker, or claims I am one, I now wont feel terribly uncomfortable going along with it. What I expected from many previous Lean Coffees: Id have to control myself to not say all the ideas and suggestions that come to mind. What happened at this Lean Coffee: It was very easy to listen, because I didnt have many ideas or suggestions, because the topics came from people who were mostly testers. Conclusions I immediately drew: Come to think of it, I have not played every role on a team. I dont know what its like to be a tester. Maybe my guesses about what its like are less wrong than some others, but theyre still gonna be wrong. This is evidently my first conference thats more testing than Agile . Cool I bet I can learn a lot here. Thanks to Troy Magennis. Markus Grtner. and Cat Swetel. I decided to try a new idea and spend a few slides drawing attention to the existence and purpose of Agile Testing Days Code of Conduct. I cant tell yet how much good this did, but it took so little time that Ill keep trying it in future conference presentations and workshops. Some nexts My next gig will be remote coaching, centered around what we notice as were pair programming and delivering working software. Ive done plenty of coaching and plenty of remote work. but not usually at the same time. Thanks to Lean Coffee with folks like Janet and Alex Schladebeck. I got some good advice on being a more effective influencer when it takes more intention and effort to have face-to-face interactions. Alex: For a personal connection, start meetings by unloading your baggage whatevers on your mind today that might be dividing your attention and inviting others to unload theirs. (Ideally, establish this practice in person first.) Janet: Ask questions that help people recognize their own situation. (Helping people orient themselves in their problem spaces is one of my go-to strengths. Im ready to be leaning harder on it.) As I learn about remote coaching, I expect to write things down at Shape My Work. a wiki about distributed Agile that Alex Harms and I created. Youll notice it has a Code of Conduct. If it makes good sense to you, wed love to learn what youve learned as a remote Agilist. I found Agile Testing Days to be a lovingly organized and carefully tuned mix of coffee breaks, efficiency, flexibility, and whimsy. The love and whimsy shone through. Im honored to have been part of it, and I sure as heck hope to be back next year. Wed be back next year anyway we visit family in Germany every December. Someday we might choose to live near them for a while. It occurs to me that having participated in Agile Testing Days might well have been an early investment in that option, and the thought pleases me. (As does the thought of hopping on a train to participate again.) Im in Europe through Christmas. I consult, coach. and train. Do you know of anyone who could use a day or three of my services One aspect of being a tester I do identify with is being frequently challenged to explain their discipline or justify their decisions to people who dont know what the work is like (and might not recognize the impact of their not knowing). In that regard, I wonder how helpful Agile in 3 Minutes is for testers. Lets say I could be so lucky as to have a few guest episodes about testing. Who would be the first few people youd want to hear from Who has a way with words and ideas, knows the work, and can speak to it in their unique voice to help the rest of us understand a bit better December 01, 2016 November 24, 2016 Interesting news come in via slashdot: Apple Releases macOS 10.12 Sierra Open Source Darwin Code. Apple has released the open source Darwin code for macOS 10.12 Sierra. The code, located on Apples open source website, can be accessed via direct link now, although it doesnt yet appear on the sites home page. The release builds on a long-standing library of open source code that dates all the way back to OS X 10.0. There, youll also find the Open Source Reference Library, developer tools, along with iOS and OS X Server resources. The lowest layers of macOS, including the kernel, BSD portions, and drivers are based mainly on open source technologies, collectively called Darwin. As such, Apple provides download links to the latest versions of these technologies for the open source community to learn and to use. This may not only be of interest to the OpenDarwin folks (or rather their successors in PureDarwin ) but more investigation not only on the code itself, but also the license it is released under is neccessary to learn if anything can be gained back for NetBSD. Why back As you may or may not remember, mac OS includes some parts of NetBSD (besides lots of FreeBSD, probably some OpenBSD, much other Open Source software and sure a big lot of Apples own code). My first job was in Operations. When I got to be a Developer, I promised myself Id remember how to be good to Ops. Ive sometimes succeeded. And when Ive been effective, its been in part due to my firsthand knowledge of both roles. DevOps is two things (hint: theyre not Dev and Ops) Part of what people mean when they say DevOps is automation. Once a system or service is in operation, it becomes more important to engineer its tendencies toward staying in operation. Applying disciplines from software development can help. These words are brought to you by a Unix server I operate. I rely on it to serve this website, those of a few friends, and a tiny podcast of some repute. Oh yeah, and my email. It has become rather important to me that these services tend to stay operational. One way I improve my chances is to simplify whats already there . If it hurts, do it more often Another way is to update my installed third-party software once a week. This introduces two pleasant tendencies: its much Less likely, at any given time, that Im running something dangerously outdated More likely, when an urgent fix is needed, that Ill have my wits about me to do it right Updating software every week also makes two strong assumptions about safety (see Modern Agiles Make Safety a Prerequisite): that I can quickly and easily Roll back to the previous versions Build and install new versions Since Ive been leaning hard on these assumptions, Ive invested in making them more true. The initial investment was to figure out how to configure pkgsrc to build a complete set of binary packages that could be installed at the same time as another complete set. My hypothesis was that then, with predictable and few side effects, I could select the active software set by moving a symbolic link . It worked. On my PowerPC Mac mini. the best-case upgrade scenario went from half an hours downtime (bring down services, uninstall old packages, install new packages, bring up services) to less than a minute (install new packages, bring down services, move symlink, bring up services, delete old packages after a while). The worst case went from over an hour to maybe a couple of minutes. Until it hurts enough less I liked the payoff on that investment a lot . Ive been adding incremental enhancements ever since. I used to do builds directly on the server: in place for low-risk leaf packages, as a separate full batch otherwise. It was straightforward to do, and I was happy to accept an occasional reduction in responsiveness in exchange for the results. After the Mac mini died. I moved to a hosted Virtual Private Server that was much easier to mimic. So I took the job offline to a local VirtualBox running the same release and architecture of NetBSD (32-bit i386 to begin with, 64-bit amd64 now, both under Xen ). The local job ran faster by some hours (I forget how many), during which the server continued devoting all its IO and CPU bandwidth to its full-time responsibilities. Last time I went and improved something was to fully automate the building and uploading, leaving myself a documented sequence of manual installation steps. Yesterday I extended that shell script to generate another shell script thats uploaded along with the packages. When the uploads done, theres one manual step: run the install script. If you can read these words, it works. DevOps is still two things Applying Dev concepts to the Ops domain is one aspect. When Im acting alone as both Dev and Ops, as in the above example, Ive demonstrated only that one aspect. The other, bigger half is collaboration across disciplines and roles. I find it takes some not-tremendously-useful effort to distinguish this aspect of DevOps from BDD or from anything else that looks like healthy cross-functional teamwork. Its the healthy cross-functional teamwork Im after. There are lots of places to start having more of that. If your teams context suggests to you that DevOps would be a fine place to start, go after it Find ways for Dev and Ops to be learning together and delivering together. Thats the whole deal. Heres another deal Two weeks from today, at Agile Testing Days in Potsdam, Germany, Im running a hands-on DevOps collaboration workshop. Can you join us Its not too late, and you can save 10 off the price of the conference ticket. Just provide my discount code when you register. Id love to see you there. November 22, 2016 According to NetBSDs wiki I can use pkgadd - uu to upgrade packages. However, when I attempt to use pkgadd - uu it results in an error. Ive tried to parse the pkgadd man page but I cant tell what the command it to update everything. I cant use pkgchk because its not installed, and I cant get the package system to install it: What is the secret command to get the OS to update everything Please forgive my ignorance with this question. I only have NetBSD systems for testing software. It gets used a few times a year, and I dont know much about it otherwise. October 27, 2016 A LAN has been set up with IPSubnet mask 192.48.1.0255.255.255.224 What is the maximum number of machines that can be set up in this LAN and why (This comes under class C network so the maximum would be 255 or less - correct me if im wrong) Suresh - email160protected sends a mail to my friend Rahul - email160protected with these three files as separate attachments as below - march-reports. ppt - Powerpoint file of size 256 KB. - locations. rar - Rar archive file of size 460 KB - me-snap. tiff - Tiff picture file of size 2970 KB. a) What is the size of the outgoing mail including mail headers b) What is the outgoing mail size if all the three files are archived as one single. rar file and sent out as one single attachment c) Show the MIME based mail structure of the outgoing mail. Show the NetBSD based C code for sending a text message Hello. This works to a remote server running on IP 122.250.110.14 on port 5050 and getting back an acknowlegement. October 10, 2016 The FreeBSD Release Engineering Team is pleased to announce the availability of FreeBSD 11.0-RELEASE. This is the first release of the stable11 branch. Some of the highlights: OpenSSH DSA key generation has been disabled by default. It is important to update OpenSSH keys prior to upgrading. Additionally, Protocol 1 support has been removed. OpenSSH has been updated to 7.2p2. Wireless support for 802.11n has been added. By default, the ifconfig(8) utility will set the default regulatory domain to FCC on wireless interfaces. As a result, newly created wireless interfaces with default settings will have less chance to violate country-specific regulations. The svnlite(1) utility has been updated to version 1.9.4. The libblacklist(3) library and applications have been ported from the NetBSD Project. Support for the AArch64 (arm64) architecture has been added. Native graphics support has been added to the bhyve(8) hypervisor. Broader wireless network driver support has been added. The release notes provide the in-depth look at the new release, and you can get it from the download page. September 14, 2016 Many programming guides recommend to begin scripts with the usrbinenv shebang in order to to automatically locate the necessary interpreter. For example, for a Python script you would use usrbinenv python. and then the saying goes, the script would just work on any machine with Python installed. The reason for this recommendation is that usrbinenv python will search the PATH for a program called python and execute the first one found and that usually works fine on ones own machine . Unfortunately, this advice is plagued with problems and assuming it will work is wishful thinking. Let me elaborate. Ill use Python below for illustration purposes but the following applies equally to any other interpreted language. i) The first problem is that using usrbinenv lets you find an interpreter but not necessarily the correct interpreter . In our example above, we told the system to look for an interpreter called python but we did not say anything about the compatible versions. Did you want Python 2.x or 3.x Or maybe exactly 2.7 Or at least 3.2 You cant tell right So the the computer cant tell either regardless, the script will probably run with whichever version happens to be called python which could be any thanks to the alternatives system. The danger is that, if the version is mismatched, the script will fail and the failure can manifest itself at a much later stage (e. g. a syntax error in an infrequent code path) under obscure circumstances. ii) The second problem, assuming you ignore the version problem above because your script is compatible with all possible versions (hah), is that you may pick up an interpreter that does not have all prerequisite dependencies installed . Say your script decides to import a bunch of third-party modules: where are those modules located Typically, the modules exist in a centralized repository that is specific to the interpreter installation (e. g. a. libpython2.7site-packages directory that lives alongside the interpreter binary). So maybe your program found a Python 2.7 under usrlocalbin but in reality you needed it to find the one in usrbin because thats where all your Python modules are. If that happens, youll receive an obscure error that doesnt properly describe the exact cause of the problem you got. iii) The third problem, assuming your script is portable to all versions (hah again) and that you dont need any modules (really), is that you are assuming that the interpreter is available via a specific name . Unfortunately, the name of the interpreter can vary. For example: pkgsrc installs all python binaries with explicitly-versioned names (e. g. python2.7 and python3.0 ) to avoid ambiguity, and no python symlink is created by default which means your script wont run at all even when Python is seemingly installed. iv) The fourth problem is that you cannot pass flags to the interpreter . The shebang line is intended to contain the name of the interpreter plus a single argument to it. Using usrbinenv as the interpreter name consumes the first slot and the name of the interpreter consumes the second, so there is no room to pass additional flags to the program. What happens with the rest of the arguments is platform-dependent: they may be all passed as a single string to env or they may be tokenized as individual arguments. This is not a huge deal though: one argument for flags is too restricted anyway and you can usually set up the interpreter later from within the script. v) The fifth and worst problem is that your script is at the mercy of the users environment configuration . If the user has a misconfigured PATH. your script will mysteriously fail at run time in ways that you cannot expect and in ways that may be very difficult to troubleshoot later on. I quote misconfigured because the problem here is very subtle. For example: I do have a shell configuration that I carry across many different machines and various operating systems such configuration has complex logic to determine a sane PATH regardless of the system Im in but this, in turn, means that the PATH can end up containing more than one version of the same program. This is fine for interactive shell use, but its not OK for any program to assume that my PATH will match their expectations. vi) The sixth and last problem is that a script prefixed with usrbinenv is not suitable to being installed . This is justified by all the other points illustrated above: once a program is installed on the system, it must behave deterministically no matter how it is invoked. More importantly, when you install a program, you do so under a set of assumptions gathered by a configure - like script or prespecified by a package manager. To ensure things work, the installed script must see the exact same environment that was specified at installation time. In particular, the script must point at the correct interpreter version and at the interpreter that has access to all package dependencies. So what to do All this considered, you may still use usrbinenv for the convenience of your own throwaway scripts (those that dont leave your machine) and also for documentation purposes and as a placeholder for a better default . For anything else, here are some possible alternatives to using this harmful shebang: Patch up the scripts during the build of your software to point to the specific chosen interpreter based on a setting the user provided at configure time or one that you detected automatically. Yes, this means you need make or similar for a simple script, but these are the realities of the environment theyll run under Rely on the packaging system do the patching, which is pretty much what pkgsrc does automatically (and I suppose pretty much any other packaging system out there). Just dont assume that the magic usrbinenv foo is sufficient or even correct for the final installed program. Bonus chatter: There is a myth that the original shebang prefix was so that the kernel could look for it as a 32-bit magic cookie at the beginning of an executable file. I actually believed this myth for a long time until today, as a couple of readers pointed me at The magic, details about the shebanghash-bang mechanism on various Unix flavours with interesting background that contradicts this. August 24, 2016 Im running NetBSD in a virtual machine. Documentation and explanations on how to use pkgsrc are scarce. Lets say I want to install vim for NetBSD. What would I type Do I need a URL Do I need a specific version Do I need to set up a directory for building the source of vim July 08, 2016 Here are some notes on installing and running NetBSDevbarm on the AllWinner A20 powered CubieBoard2. I bought this board a few weeks ago for its SATA capabilities, despite the fact that there are now cheaper boards with more powerful CPUs. Required steps for creating a bootable micro SD card are detailed on the NetBSD Wiki. and a NetBSD installation is required to run mkubootimage . I used an USB to TTL serial cable to connect to the board and create user accounts. Do not be afraid of serial, as it has in fact only advantages: there is no need to connect an USB keyboard nor an HDMI display, and it also brings back nice memories. Connecting using cu (from my OpenBSD machine) : Device name might be different when using cu on other operating systems. Adding a regular user in the wheel group : Adding a password to the newly created user and changing default shell to ksh : Installing and configuring pkgin : Finally, here is a dmesg for reference purposes : June 30, 2016 Ive been itching to go wireless on my office desk for sometime. The final wires to eradicate are from my Mac into a USB hub connected to two hard discs for backups. Years ago I had an Apple Time Capsule. The Time Capsule is an Airport Wi-Fi basestation with a hard disc for Macs to back up to using the Time Machine backup software. It was pretty solid kit for a couple of years. Under the hood, it runs NetBSD and as an aside, I have had a few beers with the guy who ported the operating system. The power supply decided to give up a very common fault apparently. I will clean the cables up. I promise. When I was on my travels and living in two places, I had hard discs in both locations. The Mac supports multiple discs for backups and I encrypted the backups in case the discs were stolen. But now Im in one home, I want to be able to move around the house with the Mac but still backup without having to go to the office. We are a two Mac house, so we need something more convenient. I already have a base station and I dont really want to shell out loads of money for an Apple one. There are several options to setup a Time Capsule equivalent. If you have a spare Mac, get a copy of Mac OS X Server. It will support Time Machine backups for multiple Macs and also supports quotas so that the size of the backups can be controlled. I dont have a spare stationary Mac. Anything that speaks Appletalk file sharing protocol reasonably well. Enter the Raspberry Pi. I have a Raspberry Pi 3 and within minutes one can install the Netatalk software. This has been available for years on Linux and implements the Apple file sharing protocols really well. With an external drive added, I was able to get a Time Machine backup working using this article . I could not use my existing backup drive as is. Linux will read and write Mac OS drives, but there is a bit of too-ing and fro-ing so it is best to start with a fresh native Linux filesystem. Even if you can get it to work with the Mac OS drive, it will not be able to use a Time Machine backup from a drive previously directly connected. Ive been using this setup for the last couple of weeks. I have not had to do a serious restore yet and I should caveat that I still have a hard drive I use directly into the machine just in case. The first rule of backups a file doesnt exist unless there are three copies on different physical media. (The Raspberry Pi is setup to be MiniDLNA server. It will stream media to Xboxs and other media players.) June 12, 2016 I installed sudo on NetBSD 7.0 using pkg. I copied usrpkgetcsudoers to etcsudoers because the docs say etcsudoers and possibly etcsudoers. local is used. I uncommented the line wheel ALL(ALL) ALL. I then added myself to the wheel group. I verified I am in wheel with groups. I then logged off and then back on. When I attempt to run sudo ltcommandgt. I get the standard: What is wrong with my sudo installation, and how can I fix it May 31, 2016 A brief description of playing around with SunOS 4.1.4, which was the last version of SunOS to be based on BSD. File Info: 17Min, 8Mb Ogg Link: archive. orgdownloadbsdtalk265bsdtalk265.ogg April 30, 2016 Playing around with the gopher protocol. Description of gopher from the 1995 book Students Guide to the Internet by David Clark. Also, at the end of the episode is audio from an interview with Mark McCahilll and Farhad Anklesaria that can be found at youtubewatchvoR76UI7aTvs Check out gopher. floodgapgopher File Info: 27 Min, 13 MB. Ogg Link:archive. orgdownloadbsdtalk264bsdtalk264.ogg March 23, 2016 This episode is brought to you by ftp, the Internet file transfer program, which first appeared in 4.2BSD. An interview with the hosts of the Garbage Podcast, joshua stein and Brandon Mercer. You can find their podcast at garbage. fm File Info: 17Min, 8MB. Ogg Link: archive. orgdownloadbsdtalk263bsdtalk263.ogg via these fine people and places: This planet is operated by Kimmo Suominen. Hosting provided by Global Wire Oy .

Comments