标签:div for pwd nbsp span 释放内存 系统配置 ring 技术分享
今天在做Firebird V3.0.3 x64 版本内存测试,本地PC上,准备开启800个事务(保持不关闭),每个事务做些事,尽量不释放内存。
每次测试当事务数达到100时,就提示Connection pool is full,此时内存才吃到500+MB。
在系统配置里没有一个选项是最大连接数,最后发现是在连接字符串里,有个选项是 MaxPoolSize 。
令 MaxPoolSize = 1000 ,程序敞开跑,最后后台进程用到 5GB多,PC内存不够了。
以下是连接字符串:
1 FbConnectionStringBuilder connBuilder = new FbConnectionStringBuilder(); 2 connBuilder.DataSource = "localhost"; 3 connBuilder.UserID = "sysdba"; 4 connBuilder.Password = "123456"; 5 connBuilder.Database = "x"; 6 connBuilder.Charset = "utf8"; 7 connBuilder.ServerType = FbServerType.Default; 8 connBuilder.Dialect = 3; 9 connBuilder.MaxPoolSize = 1000; 10 connBuilder.Pooling = true; 11 _connStr = connBuilder.ConnectionString;
测试程序:
1 for (int i = 0; i < 800; i++) 2 { 3 var db = DbCtxt.NewDbContext().UseTransaction(true); 4 for (int j = 0; j < 500; j++) 5 { 6 db.Insert("m_user").Column("code", "1234567890") 7 .Column("label", "ABCDEFGHIJ") 8 .Column("pwd", "1234").Column("is_del", false).Execute(); 9 } 10 }
内存占用:
Firebird Connection pool is full
标签:div for pwd nbsp span 释放内存 系统配置 ring 技术分享
原文地址:https://www.cnblogs.com/jonney-wang/p/9275617.html