当前位置: 首页 > news >正文

公司网站建设方案设计网络营销方案分享

公司网站建设方案设计,网络营销方案分享,亲情网络广告推广怎么做,网络营销渠道的功能包括1 背景 本文通过简单修改开源Postgresql源码#xff0c;实现批量获取事务ID的功能#xff0c;对比前后性能差异。 周末实验项目for fun#xff0c;代码可以随意使用。 #xff01;#xff01;#xff01;注意#xff1a;修改会带来的并发问题会造成数据不一致#xf…1 背景 本文通过简单修改开源Postgresql源码实现批量获取事务ID的功能对比前后性能差异。 周末实验项目for fun代码可以随意使用。 注意修改会带来的并发问题会造成数据不一致ProcArray和快照的逻辑很多都是在XID严格递增的情况下设计的修改后的xid空洞、跳变需要很大的修改量来适配。 2 改造前 性能数据没有太大参考意义只用于前后对比 16C小规格测试机128并发压测PG参数全部异步写瓶颈来到事务ID生成 128并发压测只写120秒XidGen锁每秒的出现数量均值在60左右QPS 80589 -- 参数 fsync off synchronous_commit off autovacuum offcreate table testbl1(c1 int, c2 int, c3 int, c4 text, c5 text); -- in.sql insert into testbl1 values (12,123,456,avzdsqerqwadsf,asdfgerrerg);pgbench -c 128 -j 128 -n -r -P 1 -T 120 -f ./in.sql for i in {1..60};do psql -c select count(*) from pg_stat_activity where wait_eventXidGen -A -t; sleep 1;done;0 12 100 41 0 50 45 64 94 98 97 27 ... ...3 改造方案 由于是实验项目改造会造成逻辑复制等代码crash这里不关注。 3.1 改造方案一 【本地进程】拿事务ID从一次拿一个变成一次拿N个其他不变。 关键改造点 GetNewTransactionId预存本地N个事务ID取的时候先取本地再去共享的。ExtendClogclog页面的原生扩展机制是严格按顺序递增的需要改造。GetSnapshotData要求事务ID必须严格递增这里可能会有空洞触发assert。ProcArrayEndTransactionInternal并发问题PGPROC的xids数组数据错乱。 3.2 改造方案二较复杂不做测试 拿事务ID由每个进程自己拿变成由一个进程统一分配。 4 最终效果一批拿5个xid、一批拿64个xid 结论QPS有略微提升和环境关系比较大CPU共享性能很差 QPS对比 优化前80589优化后84923 【一批拿5个xid】 vs 【一次拿1个xid】xidgen锁事件对比 xidgen明显下降瓶颈点打散到ProcArrayGroupUpdate、XactGroupUpdate等 【一批拿64个xid】 vs 【一次拿1个xid】xidgen锁事件对比 观测不到xidgen瓶颈点打散到ProcArrayGroupUpdate、XactGroupUpdate等 部分代码 FullTransactionId localTransactionId {0}; int localTransactionIdCnt 0;FullTransactionId GetNewTransactionId(bool isSubXact) {FullTransactionId full_xid;TransactionId xid;/** Workers synchronize transaction state at the beginning of each parallel* operation, so we cant account for new XIDs after that point.*/if (IsInParallelMode())elog(ERROR, cannot assign TransactionIds during a parallel operation);/** During bootstrap initialization, we return the special bootstrap* transaction id.*/if (IsBootstrapProcessingMode()){Assert(!isSubXact);MyProc-xid BootstrapTransactionId;ProcGlobal-xids[MyProc-pgxactoff] BootstrapTransactionId;return FullTransactionIdFromEpochAndXid(0, BootstrapTransactionId);}/* safety check, we should never get this far in a HS standby */if (RecoveryInProgress())elog(ERROR, cannot assign TransactionIds during recovery);bool needlock false;if (localTransactionIdCnt 0){// LWLockAcquire(XidGenLock, LW_EXCLUSIVE);Assert(localTransactionId.value 0);full_xid localTransactionId;xid XidFromFullTransactionId(full_xid);FullTransactionIdAdvance(localTransactionId);localTransactionIdCnt--;needlock false;}else{FullTransactionId prevTransactionId {0};TransactionId prevXid;LWLockAcquire(XidGenLock, LW_EXCLUSIVE);needlock true;// [1] get 1000, use 1000localTransactionId full_xid ShmemVariableCache-nextXid;xid XidFromFullTransactionId(full_xid);// [2] move local to 1001FullTransactionIdAdvance(localTransactionId);// [3] move share to 1001FullTransactionIdAdvance(ShmemVariableCache-nextXid);for (int i 0; i 5; i){prevTransactionId ShmemVariableCache-nextXid;// [4] move share to 1006 (1006 for others!)FullTransactionIdAdvance(ShmemVariableCache-nextXid);// [5] cnt 5 (local: 1001 1002 1003 1004 1005)localTransactionIdCnt;}// [6] extend once to 1005prevXid XidFromFullTransactionId(prevTransactionId);ExtendCLOG(prevXid);ExtendCommitTs(prevXid);ExtendSUBTRANS(prevXid);}Assert(localTransactionIdCnt 0);if (!isSubXact){Assert(ProcGlobal-subxidStates[MyProc-pgxactoff].count 0);Assert(!ProcGlobal-subxidStates[MyProc-pgxactoff].overflowed);Assert(MyProc-subxidStatus.count 0);Assert(!MyProc-subxidStatus.overflowed);/* LWLockRelease acts as barrier */MyProc-xid xid;ProcGlobal-xids[MyProc-pgxactoff] xid;}else{XidCacheStatus *substat ProcGlobal-subxidStates[MyProc-pgxactoff];int nxids MyProc-subxidStatus.count;Assert(substat-count MyProc-subxidStatus.count);Assert(substat-overflowed MyProc-subxidStatus.overflowed);if (nxids PGPROC_MAX_CACHED_SUBXIDS){MyProc-subxids.xids[nxids] xid;pg_write_barrier();MyProc-subxidStatus.count substat-count nxids 1;}elseMyProc-subxidStatus.overflowed substat-overflowed true;}if (needlock)LWLockRelease(XidGenLock);// elog(WARNING, [%ld](%d)-[%ld], localTransactionId.value, localTransactionIdCnt, full_xid.value);return full_xid; }#define CLOG_MAX_PAGES (UINT_MAX / CLOG_XACTS_PER_PAGE) // 131071 bool ClogPageMark[CLOG_MAX_PAGES] {false};void ExtendCLOG(TransactionId newestXact) {int pageno;/** No work except at first XID of a page. But beware: just after* wraparound, the first XID of page zero is FirstNormalTransactionId.*/// if (TransactionIdToPgIndex(newestXact) ! 0 // !TransactionIdEquals(newestXact, FirstNormalTransactionId))// return;if (ClogPageMark[TransactionIdToPage(newestXact)])return;pageno TransactionIdToPage(newestXact);LWLockAcquire(XactSLRULock, LW_EXCLUSIVE);/* Zero the page and make an XLOG entry about it */ZeroCLOGPage(pageno, true);LWLockRelease(XactSLRULock);ClogPageMark[TransactionIdToPage(newestXact)] true; }
http://www.dnsts.com.cn/news/40851.html

相关文章:

  • 代做安装预算的网站免费空间已经注册 怎么做网站
  • 天津七七一网站建设有限公司怎么样万户网站做的怎样
  • 杭州高端网站建设公司哪家好手表二级市场网站
  • 优化网站排名解析推广wordpress来源
  • 网上购书的网站开发的意义自己做网站视频教学
  • 河南郑州app建设网站互联网保险和线下保险的优缺点
  • 10大免费软件下载网站推荐网站快速排名的方法
  • 饰品网站建设东莞东坑网站设计
  • 怎样做网站优化 知乎名创 网站建设
  • 浏阳做网站的公司价格推广引流渠道平台
  • 伊春网站推广广东省建设部网站
  • flash 网站 模板获取当前分类的父级wordpress
  • 做坏事小视频网站大型门户网站建设费用
  • 网站权重查询工具罗田做网站
  • 网站开发人员 把网站注销制作网站规划书
  • 网站建设会用什么软件一个网站需要多少钱
  • 网站为什么做黄词骗流量网站建设送企业邮箱吗
  • 辽宁工程建设信息网站新媒体营销期末试卷及答案
  • wordpress网站vip可看东莞怎么建设网站公司
  • 个人能建什么样的网站个人博客网站模板源码
  • 男男床上爱做 网站河南造价信息网官网
  • 网站开发也需要源码吗网站建设的讲话要求
  • 建设工业网站花都网站开发
  • wordpress技巧:开启wordpress多站点功能伪装学渣无极网站
  • 制作网站要求网站建设蘑菇街
  • 普洱茶网站建设关键词排名优化咨询
  • 现在币圈有那些私募网站做的好开发一个小程序需要什么技术
  • 阜阳制作网站公司最近在线直播免费观看
  • 网站开发的客户群体深圳市宝安区教育局官网
  • 泉州建设银行网站百度合伙人官网app