schema

RabbitMQ 延时消息队列

别说谁变了你拦得住时间么 提交于 2019-12-21 07:04:08
一、简述 二、示例demo 单个延迟队列 多个延迟队列 一 、简述 延时消息在日常随处可见: 1、订单创建10min之后不发起支付,自动取消。 2、30min定时推送一次邮件信息。 最常用到方式为定时任务轮训,数据量小的时候使用没什么问题 而当有千万甚至上亿的数据量时就会出现数据读取的瓶颈,此时全表扫面进行处理一定是下下策。但是也有比较讨巧的方式,分享公司内部订单拆分的例子: 由于线上每天订单量50万+的增长量,单表早已无法吃撑这个增长的速度。采取的方式为订单归档:线上热数据保留2-3天的数据,其余都归档进入历史订单表中,这样热数据在200万以内。订单超过10min不支付即取消的功能,可以采取简单的扫表形式而不会出现数据读取性能的问题。 这样的方式很简单,但需要跟业务进行沟通妥协,本文会讲另一种方式即RabbitMQ延迟队列。RabbitMQ实际并没有直接实现延时队列,但可利用RabbitMQ提供的属性来模拟延时队列,甚至已经有的配套的插件 rabbitmq_delayed_message_exchange 下面先介绍使用到的RabbitMQ的属性。 1、消息的Time To Live (TTL) x-message-ttl:消息过期时间,超过过期时间之后即变为死信(Dead-letter)不会再被消费者消费。 设置消息TTL有两种方式: 创建队列时指定x-message-ttl

DB Schema for Appointment Booking App: What is the correct relationship between Doctors, Appointments, TimeSlots, Patients?

依然范特西╮ 提交于 2019-12-21 06:31:05
问题 [ UPDATED SCHEMA: http://i.imgur.com/fX9CGNh.png ] I'm tasked with developing an appointment booking system that is designed for a small medical office. It is a Rails 3.2 app. I'm having difficulty designing a database schema that makes sense to me. Question: Given the following information, what is the correct relationship between doctors, patients, appointments, chairs and time_slots? Patients need to make appointments with a doctor's office. Depending on the type of appointment, each

DB Schema for Appointment Booking App: What is the correct relationship between Doctors, Appointments, TimeSlots, Patients?

不想你离开。 提交于 2019-12-21 06:29:25
问题 [ UPDATED SCHEMA: http://i.imgur.com/fX9CGNh.png ] I'm tasked with developing an appointment booking system that is designed for a small medical office. It is a Rails 3.2 app. I'm having difficulty designing a database schema that makes sense to me. Question: Given the following information, what is the correct relationship between doctors, patients, appointments, chairs and time_slots? Patients need to make appointments with a doctor's office. Depending on the type of appointment, each

Incrementing hundreds of counters at once, redis or mongodb?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 06:24:31
问题 Background/Intent: So I'm going to create an event tracker from scratch and have a couple of ideas on how to do this but I'm unsure of the best way to proceed with the database side of things. One thing I am interested in doing is allowing these events to be completely dynamic, but at the same time to allow for reporting on relational event counters. For example, all countries broken down by operating systems. The desired effect would be: US # of events iOS - # of events that occured in US

滴滴从KV存储到NewSQL实战

不羁岁月 提交于 2019-12-21 04:29:51
0.导读 本文讲诉滴滴在分布式Nosql存储Fusion之上构建NewSQL的实践之路。详细描述Fusion-NewSQL的特性,应用场景,设计方案。 1.背景 Fusion-NewSQL是由滴滴自研的在分布式KV存储基础上构建的NewSQL存储系统。Fusion-NewSQ兼容了MySQL协议,支持二级索引功能,提供超大规模数据持久化存储和高性能读写。 ▍我们的问题 滴滴的业务快速持续发展,数据量和请求量急剧增长,对存储系统等压力与日俱增。虽然分库分表在一定程度上可以解决数据量和请求增加的需求,但是由于滴滴多条业务线(快车,专车,两轮车等)的业务快速变化,数据库加字段加索引的需求非常频繁,分库分表方案对于频繁的Schema变更操作并不友好,会导致DBA任务繁重,变更周期长,并且对巨大的表操作还会对线上有一定影响。同时,分库分表方案对二级索引支持不友好或者根本不支持。鉴于上述情况,NewSQL数据库方案就成为我们解决业务问题的一个方向。 ▍开源产品调研 最开始,我们调研了开源的分布式NewSQL方案:TIDB。虽然TIDB是非常优秀的NewSQL产品,但是对于我们的业务场景来说,TIDB并不是非常适合,原因如下: 我们需要一款高吞吐,低延迟的数据库解决方案,但是TIDB由于要满足事务,2pc方案天然无法满足低延迟(100ms以内的99rt,甚至50ms内的99rt) 我们的多数业务

Spring学习——IOC(1)

大兔子大兔子 提交于 2019-12-21 01:56:38
Spring概念 1. Spring是开源的轻量级框架; 2. Spring核心:IOC(控制反转)、AOP(面向切面编程); 3. Spring是一站式框架:Spring在javaee三层结构中,每层都提供不同的解决技术: - web层:springMVC - service层:IOC - dao层:JDBCTemplate Spring的IOC操作 1. 对象创建交给Spring进行管理; 2. IOC操作的两种方式:配置文件、注解。 IOC底层原理 原文链接: Spring IOC的原理及详解 。 1. IOC的提出是为了解决对象之间耦合度过高的问题,IOC作为“第三方”实现具有依赖关系的对象之间的解耦; 2. 控制反转:对象A获得依赖对象B的过程,由主动行为变为了被动行为,控制权颠倒过来了; 3. 依赖注入:IOC容器在运行期间,动态地将某种依赖关系注入到对象之中。控制被反转之后,获得依赖对象的过程由自身管理变为了由IOC容器主动注入; 4. IOC中最基本的技术就是“反射(Reflection)”编程; 5. 我们可以把IOC容器的工作模式看做是工厂模式的升华,可以把IOC容器看作是一个工厂,这个工厂里要生产的对象都在配置文件中给出定义,然后利用编程语言的的反射编程,根据配置文件中给出的类名生成相应的对象。从实现来看,IOC是把以前在工厂方法里写死的对象生成代码

Mybatis与Spring的整合

故事扮演 提交于 2019-12-21 01:43:21
1、导入jar包 2、创建SqlMapConfig文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <typeAliases> <typeAlias type="com.jack.po.User" alias="User"/> </typeAliases> <mappers> <mapper resource="com/jack/dao/user.xml" /> </mappers> </configuration> 3、创建User.xml映射文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="test"> <select id="findUser" parameterType="int"

Bean XML 配置(1)- 通过XML配置加载Bean

被刻印的时光 ゝ 提交于 2019-12-20 20:33:46
系列教程 Spring 框架介绍 Spring 框架模块 Spring开发环境搭建(Eclipse) 创建一个简单的Spring应用 Spring 控制反转容器(Inversion of Control – IOC) 理解依赖注入(DI – Dependency Injection) Bean XML 配置(1)- 通过XML配置加载Bean Bean XML 配置(2)- Bean作用域与生命周期回调方法配置 Bean XML 配置(3)- 依赖注入配置 Bean XML 配置(4)- 自动装配 Bean 注解(Annotation)配置(1)- 通过注解加载Bean Bean 注解(Annotation)配置(2)- Bean作用域与生命周期回调方法配置 Bean 注解(Annotation)配置(3)- 依赖注入配置 Bean Java配置 Spring 面向切面编程(AOP) Spring 事件(1)- 内置事件 Spring 事件(2)- 自定义事件 1. 定义Bean 在xml配置文件中(如"beans.xml"),添加Bean定义: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www

How to generate a diagram of a very large database schema (SQL Server)

最后都变了- 提交于 2019-12-20 17:40:58
问题 I have a very large database I need to diagram. The database is SQL Server 2008 on x64. It is large in that there are hundreds of related tables, each with up to 2000 fields (some are sparse), multiple relationships between tables (often hundreds per table, in fact), multiple schemas... you get the idea. I tried to use the Database Diagrams feature of SQL Server Management Studio, but it crashed with a Win32Exception: "Not enough storage is available to process this command..." I tried to use

failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd'

时光毁灭记忆、已成空白 提交于 2019-12-20 12:03:37
问题 While starting my Spring App, I am getting the following error : WARNING: Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. My springapp-servlet.xml is as follows : <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=