我写了一个网站(学术研究的),发布的服务器上了,服务器放在我们单位机房,我们用的共享100m光纤(中国医学院的)
想问问, 我怎样测试速度,
我用ping  x.x.x.x  -t  平均返回是70ms
偶尔 是  Request    timed out
我们本来计划放在托管机房。  
还有什么方法 能测试速度。  非常感谢

解决方案 »

  1.   

    转自:http://hi.baidu.com/ibadcool/blog/item/7ac1cb34bdcbb444241f14ce.html/*
    * ping 测速
    * 创建时间:08-03-06
    * 创建 人:alonesail
    * blog:http://hi.baidu.com/alonesail2006
    */
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Diagnostics;
    using System.Text.RegularExpressions;
    namespace alonesail.PingEx
    {
        public static class Ping
        {
            #region codes
            private const int TIME_OUT = 100;
            private const int PACKET_SIZE = 512;
            private const int TRY_TIMES = 2;        private static Regex _reg = new Regex( @"Minimum\s*=\s*\d+ms,\s*Maximum\s*=\s*\d+ms,\s*Average\s*=\s*(\d+)ms", RegexOptions.Multiline | RegexOptions.IgnoreCase );
            private static float LaunchPing( string strCommandline, int packetSize )
            {
                Process proc = new Process();
                proc.StartInfo.Arguments = strCommandline;
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.CreateNoWindow = true;
                proc.StartInfo.FileName = "ping.exe";
                proc.StartInfo.RedirectStandardInput = true;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;            proc.Start();
                string strBuffer = proc.StandardOutput.ReadToEnd();
                proc.Close();            //Console.WriteLine( strCommandline );
                //Console.WriteLine( strBuffer );            return ParseResult( strBuffer, packetSize );
            }        private static float ParseResult( string strBuffer, int packetSize )
            {
                if ( strBuffer.Length < 1 ) return 0.0F;            MatchCollection mc = _reg.Matches( strBuffer );
                if ( mc == null || mc.Count < 1 || mc[0].Groups == null ) return 0.0F;
                int avg;
                if ( !int.TryParse( mc[0].Groups[1].Value, out avg ) ) return 0.0F;
                if ( avg <= 0 ) return 1024.0F;            return (float)packetSize / avg * 1000 / 1024;
            }
            #endregion codes        /// <summary>
            /// 
            /// </summary>
            /// <param name="strHost">主机名或ip</param>
            /// <returns>kbps/s</returns>
            public static float Test( string strHost )
            {
                return LaunchPing( string.Format( "{0} -n {1} -l {2} -w {3}", strHost, TRY_TIMES, PACKET_SIZE, TIME_OUT ), PACKET_SIZE );
            }        /// <summary>
            /// 
            /// </summary>
            /// <param name="strHost">主机名或ip</param>
            /// <param name="PacketSize">发送测试包大小</param>
            /// <param name="TimeOut">超时</param>
            /// <param name="TryTimes">测试次数</param>
            /// <returns>kbps/s</returns>
            public static float Test( string strHost, int PacketSize, int TimeOut, int TryTimes )
            {
                return LaunchPing( string.Format( "{0} -n {1} -l {2} -w {3}", strHost, TryTimes, PacketSize, TimeOut ), PacketSize );
            }
        }
    }//end classs//////////////////////////////调用程序
    using System;
    using System.Collections.Generic;
    using System.Text;namespace Ivan.PingEx
    {
        class Program
        {
            static void Main( string[] args )
            {
                Console.WriteLine( Ping.Test( "http://hi.baidu.com/gufanlf" ) );
                Console.Read();
            }
        }
      

  2.   

    方法一: ping 不能高于100ms,最好不要有time out,这个也是最常用的。70ms照目前的网络状况,有一点点慢。
    方法二: tracert  www.youdomain.com ,看看你的主机那个节点的ms数,有时候ping时间长,不一定是主机的问题,是你到你主机的路程中的问题.
    方法三: 在你网站上下载个文件,看看速度。