当前位置:网站首页>Detailed explanation of swoole memory table
Detailed explanation of swoole memory table
2022-07-28 01:11:00 【Life goes on and battles go on】
Memory operation module
Lock Buffer Table Atomic mmap channel serialize
Introduce
swooletable It is an ultra-high performance based on shared memory and lock , Concurrent data structure
advantage
- Strong performance , Single thread reads and writes per second 200 Ten thousand times
- Application code does not need to be locked ,Table Built in row lock spin lock , All operations are multithreaded / Multi process security . The user layer does not need to consider the problem of data synchronization at all ;
- Support multiple processes ,Table It can be used to share data among multiple processes
- Use row lock , Instead of global lock , Only when the 2 Processes are in the same cpu Time , Lock grabbing occurs only when the same data is read concurrently
table.php
<?php
// Create a memory table
$table = new \Swoole\Table(1024);
// Add a column to the memory table
$table->column('id', $table::TYPE_INT,4);
$table->column('name', $table::TYPE_STRING,64);
$table->column('age', $table::TYPE_INT,3);
$table->create();
$table->set('wyt',['id'=>1,'name'=>'wyt','age'=>18]);
print_r($table->get('wyt'));result
Self increasing
$table->incr('wyt','age',2);Self reduction
$table->decr('wyt','age',2);边栏推荐
- 立即报名 | 云原生技术交流 Meetup 广州站已开启,8 月 6 号与你相遇!
- Function related knowledge
- Redis缓存穿透击穿和雪崩
- Oracle error: ora-01722 invalid number
- C type use of reflection
- Circular structure of shell system learning
- 共创文旅新篇章|新起典与国华文旅签订战略合作协议
- Uni app advanced style framework / production environment
- 数据库故障容错之系统时钟故障
- Process and process scheduling
猜你喜欢

Red team killer behinder_ V4.0 (ice scorpion 4.0)

Redis-哨兵模式

Function related knowledge
![Jerry Zhi doesn't play hidden audio files [article]](/img/09/b9fb293151f56d2a93f8a1c8f3d0dc.png)
Jerry Zhi doesn't play hidden audio files [article]

Interface test practical project 02: read interface test documents and practice

怎么清晰地理解、表达 IaaS 、 PaaS 、 SaaS ?

Examples of application of JMeter in performance testing

Array related knowledge

网络安全漏洞分析与漏洞复现

The most detailed summary of common English terms in the chip industry (quick grasp of graphics and text)
随机推荐
【OpenCV 例程 300篇】241. 尺度不变特征变换(SIFT)
Redis缓存穿透击穿和雪崩
oracle分组取最大值
范德蒙德卷积 学习笔记
文件系统挂载
scrollview、tableView嵌套解决方案
Jerry caused other messages to accumulate in the message pool [article]
怎么清晰地理解、表达 IaaS 、 PaaS 、 SaaS ?
Syntaxerror resolved: positive argument follows keyword argument
Wavelet transform learning notes
0-1 knapsack problem
Use of postman
Six relationships of UML class diagram, the best way to learn and understand
Jerry's prompt sound processing when switching devices [chapter]
Jmeter在性能测试中的应用实践样例
Branch and loop sentence exercises
红队大杀器 Behinder_v4.0(冰蝎4.0)
c# 反射之Type使用
C language programming | explanation and Simulation of offsetof macro
swoole-WebSocket服务