نمایش نتایج: از شماره 1 تا 1 , از مجموع 1

موضوع: کنترل منابع سرور از طریق ویبولتین

  1. #1
    کاربر اخراج شده
    تاریخ عضویت
    Oct 2011
    نوشته ها
    5
    تشکر تشکر کرده 
    1
    تشکر تشکر شده 
    9
    تشکر شده در
    6 پست

    113 کنترل منابع سرور از طریق ویبولتین

    به طوری کلی کنترل یک سایت از تمامی جوانب کاری بسیار مهم می باشد. در این آموزش شما با انجام یک سری کارها میتونید منابع سرور خودتون و کارکرد هرکدوم رو کنترل کنید و اگر هر کدوم از بخش ها دچار مشکلی بود بررسی کنید. این آموزش طبق گفته ی نویسنده ی اون برای وی بی 3 نوشته شده اما برای خیلی ها بر روی وی بی 4 هم کار کرده به درستی. برای انجام این کار به AdminCp خود برید. ایجاد یک پلاگین رو بزنید. admin_index_main3 رو انتخاب کنید و کد زیر را وارد کنید:

    کد:
    $memcache = new Memcache;  foreach ($vbulletin->config['Misc']['memcacheserver'] as $key => $server) {     $memcache->addServer($server,  $vbulletin->config['Misc']['memcacheport'][$key], 1, 1, 1, 15, true); }  $stats = $memcache->getExtendedStats(); $memcache->close();  $labels = array (     'host' => 'Host',      'pid' => 'PID',      'uptime' => 'Daemon Uptime',      'time' => 'Server Time',      'version' => 'Version',      'pointer_size' => 'Pointer Bits',      'rusage_user' => 'RUsage User',      'rusage_system' => 'RUsage System',      'curr_items' => 'Current Items',      'total_items' => 'Total Items',      'bytes' => 'Memory Used',      'curr_connections' => 'Current Connections',      'total_connections' => 'Total Connections',      'connection_structures' => 'Connection Structures',      'cmd_flush' => 'Flushes',      'cmd_get' => 'Gets',      'cmd_set' => 'Sets',      'get_hits' => 'Get Hits',      'get_misses' => 'Get Misses',      'delete_hits' => 'Delete Hits',      'delete_misses' => 'Delete Misses',      'incr_hits' => 'Increment Hits',      'incr_misses' => 'Increment Misses',      'decr_hits' => 'Decrement Hits',      'decr_misses' => 'Decrement Misses',      'cas_hits' => 'CAS Hits',      'cas_misses' => 'CAS Misses',      'cas_badval' => 'CAS Bad Value',      'auth_cmds' => 'Auth Commands',      'auth_errors' => 'Auth Errors',      'evictions' => 'Evictions',      'reclaimed' => 'Reclaimed',      'bytes_read' => 'Data Read In',      'bytes_written' => 'Data Written Out',      'limit_maxbytes' => 'Memory Allocated',      'threads' => 'Threads',      'accepting_conns' => 'Accepting Connections',      'conn_yields' => 'Connection Yields',      'listen_disabled_num' => 'Listening Disabled Num',      'latency' => 'Latency Test',  );  $data = array('Host' => '', 'Latency Test' => '', 'Memory Allocated' => '', 'Memory Used' => '', 'Current Items' => '', 'Total Items' => '');  $i=1;  foreach($stats as $key => $val) {        if (is_array($val)) {         $data[$labels['host']][] = $key;         foreach($val as $key2 => $val2) {             $data[$labels[$key2]][] =                  (strpos($key2, 'bytes') !== false) ? vb_number_format($val2, 2, true) . iif (preg_match("#(bytes_read|bytes_written)#si", $key2), ' (' . vb_number_format(intval($val2/$val['uptime']), 2, true) . '/sec)') :                  ($key2 == 'time' ? date("M j, Y, G:i:s", $val2) :                  (preg_match("#(curr_items|total_items|curr_connections|total_connections|connection_structures|cmd_get|cmd_set|get_hits|get_misses)#si", $key2) ? number_format($val2) :                  ($key2 == 'uptime' ? intval($val2 / 86400) . 'd, ' . intval(($val2 % 86400) / 3600) . 'h, ' . intval(($val2 % 3600) / 60) . 'm, ' . intval($val2 % 60) . 's'  : $val2))) .                  iif (preg_match("#(total_connections|cmd_get|cmd_set|bytes_read|bytes_written|get_hits|get_misses)#si", $key2), ' (' . intval($val2/$val['uptime']) . '/sec)');         }                  $latency = microtime();         $memcache = new Memcache;         $memcache->addServer($vbulletin->config['Misc']['memcacheserver'][$i]);         $set = $memcache->set('latency-test', 'some value', 0, 10);         $get = $memcache->get('latency-test');         $memcache->close();         $data[$labels['latency']][] = round ((microtime() - $latency) * 1000, 4) . ' ms';         $i++;     } } print_table_start(); print_table_header('Memcached Servers', count($stats) + 1); foreach($data as $key => $val) {     print_cells_row(array_merge((array)"<strong>$key</strong>", $val), 0, 0, -5, 'top', 0, 1); } print_table_footer(2, '', '', false);

  2. تعداد تشکر ها از maht@b به دلیل پست مفید


  3. # ADS




     

اطلاعات موضوع

کاربرانی که در حال مشاهده این موضوع هستند

در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)

موضوعات مشابه

  1. پاسخ ها: 1
    آخرين نوشته: September 9th, 2014, 11:20
  2. آموزش اضافه کردن alt به تصاویر در ویبولتین
    توسط boy_evil در انجمن مباحث دیگر
    پاسخ ها: 0
    آخرين نوشته: January 20th, 2014, 11:39
  3. پاسخ ها: 0
    آخرين نوشته: June 16th, 2013, 14:08
  4. پاسخ ها: 0
    آخرين نوشته: February 20th, 2013, 17:15

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •