[TestMethod]
        
public void TestWCF()
        {
            RService.PlayerServiceClient client = 
new Remoting.Test.RService.PlayerServiceClient();

            
for (int i = 0; i < 10; i++)
            {
                client.Login(
"xxxx@hotmail.com""xxxxxxxxxxxxxxxx");
            }
        }


        [TestMethod]
        
public void TestDirectAccess()
        {
            
for (int i = 0; i < 10; i++)
            {
                player.Login(
"xxxx@hotmail.com""xxxxxxxxxxxxxxxxx");
            }
        }


PlayerService.Login的代码为

public Remoting.Contract.Data.PlayerInfo Login(string username, string password)
        {
            
using (Player player = new Player())
            {
                
return player.Login(username, password);
            }
        }

TestDirectAccess相当于直接调用这段代码。数据库在另外一台电脑上,其他的所有程序运行在同一电脑,10次反复测试结果如下




后来我在TestDirectAccess和 TestWcf后面加了几个同样的函数,视乎看出了问题处理,主要时间还是消耗在数据库的连接创建上。

posted on 2008-06-05 14:28  以天  阅读(422)  评论(0编辑  收藏  举报