SmartSql = Dapper + MyBatis + Cache(Memory | Redis) + ZooKeeper + R/W Splitting + ......
SmartSql
Why
- 拥抱 跨平台 DotNet Core,是时候了。
- 高性能、高生产力,超轻量级的ORM。156kb (Dapper:168kb)
So SmartSql
- TargetFrameworks: .NETFramework 4.6 & .NETStandard 2.0
- SmartSql = SmartSql = MyBatis + Cache(Memory | Redis) + ZooKeeper + R/W Splitting +Dynamic Repository + ......
主要特性
- 1 ORM
- 1.1 Sync
- 1.2 Async
- 2 XmlConfig & XmlStatement -> Sql
- 2.1 SmartSqlMapConfig & SmartSqlMap (是的,你猜对了,和MyBatis一样,通过XML配置分离SQL。)
- 2.2 Config Hot Update ->ConfigWatcher & Reload (配置文件热更新:当你需要修改Sql的时候,直接修改SqlMap配置文件,保存即可。)
- 3 读写分离
- 3.1 读写分离
- 3.2 多读库 权重筛选 (配置多读库,根据读库权重选举读库)
- 4 日志
- 4.1 基于 Microsoft.Extensions.Logging.Abstractions (当你需要跟踪调试的时候一切都是那么一目了然)
- 5 Dynamic Repository
- 5.1 SmartSql.DyRepository (解放你的双手,你来定义仓储接口,我来实现数据库访问)
- 6 查询缓存 (热数据缓存,一个配置轻松搞定)
- 6.1 SmartSql.Cache.Memory
- 6.1.1 Fifo
- 6.1.2 Lru
- 6.2 SmartSql.Cache.Redis
- 6.3 缓存事务一致性
- 6.1 SmartSql.Cache.Memory
- 7 分布式配置插件
- 7.1 IConfigLoader (配置文件加载器)
- 7.2 LocalFileConfigLoader (本地文件配置加载器)
- 7.2.1 Load SmartSqlMapSource Xml
- 7.3.1 Load SmartSqlMapSource Directory
- 7.3 SmartSql.ZooKeeperConfig (ZooKeeper 分布式配置文件加载器)
性能评测
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.201
[Host] : .NET Core 2.0.7 (CoreCLR 4.6.26328.01, CoreFX 4.6.26403.03), 64bit RyuJIT
DefaultJob : .NET Core 2.0.7 (CoreCLR 4.6.26328.01, CoreFX 4.6.26403.03), 64bit RyuJIT
| ORM | Type | Method | Return | Mean | Error | StdDev | Rank | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Native | NativeBenchmarks | Query_GetValue_DbNull | IEnumerable`1 | 78.39 ms | 0.8935 ms | 0.7921 ms | 1 | 3000.0000 | 1125.0000 | 500.0000 | 15.97 MB |
| SmartSql | SmartSqlBenchmarks | Query | IEnumerable`1 | 78.46 ms | 0.2402 ms | 0.1875 ms | 1 | 2312.5000 | 1000.0000 | 312.5000 | 12.92 MB |
| SmartSqlDapper | SmartSqlDapperBenchmarks | Query | IEnumerable`1 | 78.65 ms | 1.2094 ms | 1.1312 ms | 1 | 3687.5000 | 1437.5000 | 687.5000 | 19.03 MB |
| Native | NativeBenchmarks | Query_IsDBNull_GetValue | IEnumerable`1 | 78.84 ms | 0.8984 ms | 0.7502 ms | 1 | 2312.5000 | 1000.0000 | 312.5000 | 12.92 MB |
| Dapper | DapperBenchmarks | Query | IEnumerable`1 | 79.00 ms | 1.0949 ms | 0.9706 ms | 1 | 3312.5000 | 1312.5000 | 625.0000 | 17.19 MB |
| EF | EFBenchmarks | Query | IEnumerable`1 | 79.44 ms | 1.6880 ms | 1.5789 ms | 1 | 6250.0000 | - | - | 26.05 MB |
| SqlSugar | SqlSugarBenchmarks | Query | IEnumerable`1 | 81.09 ms | 0.8718 ms | 0.7728 ms | 2 | 2187.5000 | 875.0000 | 250.0000 | 12.64 MB |
| Chloe | ChloeBenchmarks | Query | IEnumerable`1 | 83.86 ms | 1.2714 ms | 1.1893 ms | 3 | 2250.0000 | 937.5000 | 312.5000 | 12.62 MB |
| EF | EFBenchmarks | SqlQuery | IEnumerable`1 | 89.11 ms | 0.7562 ms | 0.6314 ms | 4 | 8187.5000 | 125.0000 | - | 33.68 MB |
| EF | EFBenchmarks | Query_NoTracking | IEnumerable`1 | 93.13 ms | 0.8458 ms | 0.7912 ms | 5 | 5875.0000 | 2250.0000 | 1062.5000 | 29.71 MB |
| EF | EFBenchmarks | SqlQuery_NoTracking | IEnumerable`1 | 106.89 ms | 1.0998 ms | 1.0288 ms | 6 | 7437.5000 | 2875.0000 | 1312.5000 | 37.34 MB |
Nuget Packages
| Package | NuGet Stable | Downloads |
|---|---|---|
| SmartSql | ||
| SmartSql.TypeHandler | ||
| SmartSql.DyRepository | ||
| SmartSql.DIExtension | ||
| SmartSql.Cache.Redis | ||
| SmartSql.ZooKeeperConfig | ||
| SmartSql.Options |
示例项目
文档地址
技术交流
点击链接加入QQ群【SmartSql 官方交流群】:604762592
SmartSql = Dapper + MyBatis + Cache(Memory | Redis) + ZooKeeper + R/W Splitting + ......的更多相关文章
- 【OF框架】框架Cache/Session在负载均衡部署时,切换Memory/Redis测试
一.切换Memory/Redis 第一步:安装运行Redis服务,获得连接参数. 第二步:在appsettings.json中配置 EnableRedisCache 和 Redisconnection ...
- SpringMVC+Mybatis+MySQL配置Redis缓存
SpringMVC+Mybatis+MySQL配置Redis缓存 1.准备环境: SpringMVC:spring-framework-4.3.5.RELEASE-dist Mybatis:3.4.2 ...
- SpringBoot之Mybatis操作中使用Redis做缓存
上一博客学习了SpringBoot集成Redis,今天这篇博客学习下Mybatis操作中使用Redis做缓存.这里其实主要学习几个注解:@CachePut.@Cacheable.@CacheEvict ...
- Spring Boot(八)集成Spring Cache 和 Redis
在Spring Boot中添加spring-boot-starter-data-redis依赖: <dependency> <groupId>org.springframewo ...
- Virtual address cache memory, processor and multiprocessor
An embodiment provides a virtual address cache memory including: a TLB virtual page memory configure ...
- 完整SpringBoot Cache整合redis缓存(二)
缓存注解概念 名称 解释 Cache 缓存接口,定义缓存操作.实现有:RedisCache.EhCacheCache.ConcurrentMapCache等 CacheManager 缓存管理器,管理 ...
- django自带cache结合redis创建永久缓存
0916自我总结 django自带cache结合redis创建永久缓存 1.redis库 1.安装redis与可视化操作工具 1.安装redis https://www.runoob.com/redi ...
- MyBatis源码分析(五):MyBatis Cache分析
一.Mybatis缓存介绍 在Mybatis中,它提供了一级缓存和二级缓存,默认的情况下只开启一级缓存,所以默认情况下是开启了缓存的,除非明确指定不开缓存功能.使用缓存的目的就是把数据保存在内存中,是 ...
- MyBatis Cache配置
@(MyBatis)[Cache] MyBatis Cache配置 MyBatis提供了一级缓存和二级缓存 配置 全局配置 配置 说明 默认值 可选值 cacheEnabled 全局缓存的开关 tru ...
随机推荐
- 多项式与三角函数求导——BUAA OO 第一单元作业总结
第一次作业 需求简要说明 针对符合规定的多项式表达式输出其符合格式规定的导函数多项式,格式错误输出WRONG FORMAT! 带符号整数 支持前导0的带符号整数,符号可省略,如: +02.-16> ...
- Java的四种引用——强引用、软引用、弱引用、虚引用
目录 强引用 软引用 弱引用 虚引用 强引用 拥有强引用的对象永远不会被GC,可以根据引用的get方法获取到被引用对象 软引用 在内存充足的额时候,拥有软引用的对象不会被GC:即将内存溢出的时候,会对 ...
- tf.contrib.slim arg_scope
缘由 最近一直在看深度学习的代码,又一次看到了slim.arg_scope()的嵌套使用,具体代码如下: with slim.arg_scope( [slim.conv2d, slim.separab ...
- JavaScript中实现小数点后保留2位
在项目中有时候会遇到要求输入的数字是整数或者小数点后绑定2位小数,因此可以用.toFixed(2)方法 下面是关于toFixed()方法的demo: <input type="numb ...
- oracle 报错无法从套接字获取更多数据
报错信息如下: ---查看_optimizer_join_elimination_enabled参数值 切换sys用户 select a.ksppinm name, b.ksppstvl value, ...
- echarts-for-react 从新渲染数据
<ReactEcharts option={option} notMerge={true} style={{height: '600px', width: '100%'}} className ...
- ORACLE 查询近一天,近半小时内的数据
SELECT 字段 FROM 表名 WHERE 时间字段 BETWEEN SYSDATE-1 AND SYSDATE; //查询一天内的数据 sysdate+1 加一天sysdate+1/24 ...
- 依赖注入[5]: 创建一个简易版的DI框架[下篇]
为了让读者朋友们能够对.NET Core DI框架的实现原理具有一个深刻而认识,我们采用与之类似的设计构架了一个名为Cat的DI框架.在<依赖注入[4]: 创建一个简易版的DI框架[上篇]> ...
- [Swift]LeetCode824. 山羊拉丁文 | Goat Latin
A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and up ...
- [Swift]LeetCode948. 令牌放置 | Bag of Tokens
You have an initial power P, an initial score of 0 points, and a bag of tokens. Each token can be us ...