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

跟公司产品做网站wordpress小程序音频插件

跟公司产品做网站,wordpress小程序音频插件,怎么给网站做aap,莆田百度推广开户Java生鲜电商平台-微服务入门与服务的拆分架构实战 刚开始进入软件行业时还是单体应用的时代#xff0c;前后端分离的概念都还没普及#xff0c;开发的时候需要花大量的时间在“强大”的JSP上面#xff0c;那时候SOA已经算是新技术了。现在#xff0c;微服务已经大行其道前后端分离的概念都还没普及开发的时候需要花大量的时间在“强大”的JSP上面那时候SOA已经算是新技术了。现在微服务已经大行其道有哪个互联网产品不说自己是微服务架构呢 但是对于微服务的理解每个人都不太一样这篇文章主要是聊一聊我对微服务的理解以及如何搭建经典的微服务架构目的是梳理一下自己的一些想法如果存在不同看法的欢迎指正 什么是微服务 首先什么是微服务呢 单体应用 相对的要理解什么是微服务那么可以先理解什么是单体应用在没有提出微服务的概念的“远古”年代一个软件应用往往会将应用所有功能都开发和打包在一起那时候的一个B/S应用架构往往是这样的 B/S 但是当用户访问量变大导致一台服务器无法支撑时怎么办呢加服务器加负载均衡架构就变成这样了 B/S负载均衡 后面发现把静态文件独立出来通过CDN等手段进行加速可以提升应用的整体相应单体应用的架构就变成 B/S前后端分离 上面3中架构都还是单体应用只是在部署方面进行了优化所以避免不了单体应用的根本的缺点 代码臃肿应用启动时间长代码超过1G的项目都有回归测试周期长修复一个小小bug可能都需要对所有关键业务进行回归测试。应用容错性差某个小小功能的程序错误可能导致整个系统宕机伸缩困难单体应用扩展性能时只能整个应用进行扩展造成计算资源浪费。开发协作困难一个大型应用系统可能几十个甚至上百个开发人员大家都在维护一套代码的话代码merge复杂度急剧增加。微服务 我认为任何技术的演进都是有迹可循的任何新技术的出现都是为了解决原有技术无法解决的需求所以微服务的出现就是因为原来单体应用架构已经无法满足当前互联网产品的技术需求。 在微服务架构之前还有一个概念SOAService-Oriented Architecture-面向服务的体系架构。我认为的SOA只是一个架构模型的方法论并不是一个明确而严谨的架构标准只是后面很多人将SOA与The Open Group的SOA参考模型等同了认为严格按照TOG-SOA标准的才算真正的SOA架构。SOA就已经提出的面向服务的架构思想所以微服务应该算是SOA的一种演进吧。 撇开架构先不说什么样的服务才算微服务呢 单一职责的。一个微服务应该都是单一职责的这才是“微”的体现一个微服务解决一个业务问题注意是一个业务问题而不是一个接口。面向服务的。将自己的业务能力封装并对外提供服务这是继承SOA的核心思想一个微服务本身也可能使用到其它微服务的能力。我觉得满足以上两点就可以认为典型的微服务。 微服务典型架构 微服务架构核心是为了解决应用微服务化之后的服务治理问题。 应用微服务化之后首先遇到的第一个问题就是服务发现问题一个微服务如何发现其他微服务呢最简单的方式就是每个微服务里面配置其他微服务的地址但是当微服务数量众多的时候这样做明显不现实。所以需要使用到微服务架构中的一个最重要的组件服务注册中心所有服务都注册到服务注册中心同时也可以从服务注册中心获取当前可用的服务清单 服务注册中心   解决服务发现问题后接着需要解决微服务分布式部署带来的第二个问题服务配置管理的问题。当服务数量超过一定程度之后如果需要在每个服务里面分别维护每一个服务的配置文件运维人员估计要哭了。那么就需要用到微服务架构里面第二个重要的组件配置中心微服务架构就变成下面这样了 配置中心 以上应用内部的服务治理当客户端或外部应用调用服务的时候怎么处理呢服务A可能有多个节点服务A、服务B和服务C的服务地址都不同服务授权验证在哪里做这时就需要使用到服务网关提供统一的服务入口最终形成典型微服务架构 典型微服务架构 上面是一个典型的微服务架构当然微服务的服务治理还涉及很多内容比如 通过熔断、限流等机制保证高可用微服务之间调用的负载均衡分布式事务2PC、3PC、TCC、LCN等服务调用链跟踪等等。微服务框架 目前国内企业使用的微服务框架主要是Spring Cloud和Dubbo或者DubboX但是Dubbo那两年的停更严重打击了开发人员对它的信心Spring Cloud已经逐渐成为主流比较两个框架的优劣势的文章在网上有很多这里就不重复了选择什么框架还是按业务需求来吧业务框架决定技术框架。 Spring Cloud全家桶提供了各种各样的组件基本可以覆盖微服务的服务治理的方方面面以下列出了Spring Cloud一些常用组件 Spring Cloud常用组件 搭建典型微服务架构 本章节主要介绍如何基于Spring Cloud相关组件搭建一个典型的微服务架构。 首先创建一个Maven父项目spring-cloud-examples用于管理项目依赖包版本。由于Spring Cloud组件很多为保证不同组件之间的兼容性一般通过spring-cloud-dependencies统一管理Spring Cloud组件版本而非每个组件单独引入。 pom.xml配置如下 !-- 继承SpringBoot父项目注意与SpringCloud版本的匹配 --parentgroupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-parent/artifactId version2.1.4.RELEASE/version /parent properties spring.boot.version2.1.4.RELEASE/spring.boot.version spring.cloud.versionGreenwich.SR1/spring.cloud.version lombok.version1.18.8/lombok.version maven.compiler.plugin.version3.8.1/maven.compiler.plugin.version /properties dependencyManagement dependencies dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-dependencies/artifactId version${spring.cloud.version}/version typepom/type scopeimport/scope /dependency /dependencies /dependencyManagement 搭建服务配置中心 在spring-cloud-examples项目下创建一个子项目spring-cloud-example-config添加Spring Cloud Config Server端的相关依赖包:dependenciesdependencygroupIdorg.springframework.cloud/groupId artifactIdspring-cloud-config-server/artifactId /dependency /dependencies 添加Spring Boot配置文件application.yml配置如下spring:application:name: spring-cloud-example-configprofiles:active: native #启用本地配置文件cloud:config:server:native:search-locations: classpath:/configs/ #配置文件扫描目录server:port: 8000 #服务端口启动类添加注解EnableConfigServer通过启用Config Server服务。SpringBootApplication EnableConfigServer public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } 搭建服务注册中心 在spring-cloud-examples项目下创建一个子项目spring-cloud-example-registry在pom.xml中添加Eureka Server相关依赖包 dependenciesdependencygroupIdorg.springframework.cloud/groupId artifactIdspring-cloud-netflix-eureka-server/artifactId /dependency dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-config/artifactId /dependency /dependencies 在spring-cloud-example-config配置中心项目的src/main/resource/configs目录下添加一个服务配置文件spring-cloud-example-registry.yml配置如下spring:application:name: spring-cloud-example-registry# Eureka相关配置 eureka:client:register-with-eureka: false #不注册服务fetch-registry: false #不拉去服务清单 serviceUrl: defaultZone: http://localhost:${server.port}/eureka/ #多个通过英文逗号分隔 server: port: 8001 在spring-cloud-example-registry项目的src/main/resource/目录添加bootstrap.yml配置文件配置如下spring:cloud:config:name: spring-cloud-example-registry #配置文件名称多个通过逗号分隔uri: http://localhost:8000 #Config Server服务地址启动类添加注解EnableEurekaServer通过启用Eureka Server服务。SpringBootApplication EnableEurekaServer public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } 搭建业务服务A 在spring-cloud-examples项目下创建一个业务服务A的子项目spring-cloud-example-biz-a在pom.xml中添加以下依赖包 dependencies!-- Spring Boot Web Starter --dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId /dependency !-- feign -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-openfeign/artifactId /dependency !-- Eureka Client Starter -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-netflix-eureka-client/artifactId /dependency !-- Config Client Starter -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-config/artifactId /dependency /dependencies 在spring-cloud-example-config配置中心项目的src/main/resource/configs目录下添加一个服务配置文件spring-cloud-example-biz-a.yml配置如下spring:application:name: spring-cloud-example-biz-aserver:port: 8010# Eureka相关配置 eureka:client:serviceUrl:defaultZone: http://localhost:8001/eureka/instance:lease-renewal-interval-in-seconds: 10 # 心跳时间即服务续约间隔时间缺省为30s lease-expiration-duration-in-seconds: 60 # 发呆时间即服务续约到期时间缺省为90s prefer-ip-address: true instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}} 在spring-cloud-example-biz-a项目的src/main/resource/目录添加bootstrap.yml配置文件配置如下spring:cloud:config:name: spring-cloud-example-biz-a #配置文件名称多个通过逗号分隔uri: http://localhost:8000 #Config Server服务地址添加一个示例接口代码参考RestController RequestMapping(/hello) public class HelloController { /** * 示例方法 * * return */ GetMapping public String sayHello() { return Hello,This is Biz-A Service.; } } 搭建业务服务B 参考上面业务服务A搭建另外一个业务服务B。 搭建服务网关 在spring-cloud-examples项目下创建一个业务服务A的子项目spring-cloud-example-gateway在pom.xml中添加以下依赖包 dependencies!-- zuul --dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-netflix-zuul/artifactId /dependency !-- Eureka Client Starter -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-netflix-eureka-client/artifactId /dependency !-- Config Client Starter -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-config/artifactId /dependency /dependencies 在spring-cloud-example-config配置中心项目的src/main/resource/configs目录下添加一个服务配置文件spring-cloud-example-gateway.yml配置如下spring:application:name: spring-cloud-example-gatewayserver:port: 8002# Eureka相关配置 eureka:client:serviceUrl:defaultZone: http://localhost:8001/eureka/instance:lease-renewal-interval-in-seconds: 10 # 心跳时间即服务续约间隔时间缺省为30s lease-expiration-duration-in-seconds: 60 # 发呆时间即服务续约到期时间缺省为90s prefer-ip-address: true instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}} 在spring-cloud-example-gateway项目的src/main/resource/目录添加bootstrap.yml配置文件配置如下spring:cloud:config:name: spring-cloud-example-gateway #配置文件名称多个通过逗号分隔uri: http://localhost:8000 #Config Server服务地址启动类添加注解EnableZuulProxy通过启用网关代理服务。SpringBootApplication EnableZuulProxy public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } 启动示例 启动顺序spring-cloud-example-configspring-cloud-example-eurekaspring-cloud-example-biz-a/spring-cloud-example-biz-b/spring-cloud-example-gateway 通过网关访问服务A接口 服务A调用 通过网关访问服务B接口 服务B调用 服务之间调用 在业务服务A中添加一个Feign Client Bean参考代码如下FeignClient(name spring-cloud-example-biz-b) # 指定服务名称 public interface RemoteService { /** * 调用服务B的hello方法 * * return */ GetMapping(/hello) #指定请求地址 String sayHello(); } 业务服务A示例接口类增加call2b接口代码如下RestController RequestMapping(/hello) public class HelloController { Autowired private RemoteService remoteService; /** * 示例方法 * * return */ GetMapping public String sayHello() { return Hello,This is Biz-A Service.; } /** * 示例方法调用服务B * * return */ GetMapping(path /call2b) public String sayHello2B() { return remoteService.sayHello(); } } 重启业务服务A通过调用/hello/call2b接口 服务之间调用 下一代微服务 目前网上很多说是下一代微服务架构就是Service MeshService Mesh主流框架有Linkerd和Istio其中Istio有大厂加持所以呼声更高。Service Mesh我接触还不多但是个人感觉并不一定能称为下一代微服务架构可能认为是服务治理的另外一种解决方案更合适是否能够取代当前的微服务架构还需要持续观察。 转载于:https://www.cnblogs.com/jurendage/p/11331366.html
http://www.zqtcl.cn/news/715923/

相关文章:

  • 济南网站建设模板python网站开发用什么软件
  • 北京品牌网站建设阿里巴巴logo图片
  • 做宣传册从哪个网站找素材中文在线っと好きだっ
  • 国际物流东莞网站建设wap是什么意思的缩写
  • 传奇官网百度seo营销网站
  • 如何在导航网站上做链接上海建筑设计研究院
  • 微信营销软件网站建设推广链接
  • 美的集团网站建设方案书广汉做网站
  • 个人博客网站实验报告商标购买网站
  • 2020给个免费网站好人有好报做购物微信网站
  • 做淘宝客网站挣钱济南百度竞价代运营
  • 国外网站404错误页网站地址搜索
  • 做 暧视频在线观看网站北京安卓app开发公司
  • h5哪个网站可以做惠州+企业网站建设
  • 网站运营知识哪个网站可以做免费商业推广
  • 电脑做网站怎么解析域名河南郑州静默管理
  • 项目网站制作冯提莫斗鱼前在哪个网站做直播
  • 网站建设 思路wordpress 访问记录插件
  • 网站建设diyseo课程培训班费用
  • 舞蹈培训东莞网站建设做直播网站
  • app建设网站公司网站制作预算
  • 移动端网站如何开发市辖区郑州网站建设
  • 山东省双体系建设网站wordpress 帮助 主题
  • 手机怎么做三个视频网站网站建设协议一百互联
  • 创建一个网站一般步骤有哪些安徽软件定制开发
  • 网站建设平台协议书模板下载佳木斯建网站的
  • 部队网站建设招标二级域名注册平台
  • 做网站怎么调用栏目织梦搞笑图片网站源码
  • 开个小网站要怎么做南宁seo外包服务商
  • 济宁做网站的企业app网站开发学习