Architecture: Small electricity supplier Web architecture

Electricity supplier site architecture, too, now Niubi electricity provider website, it seems very complicated, very fast hardware, in fact, from the very small architecture, but also no technical content from the beginning. The evolution of architecture, that is, the technical team, the constant pursuit of the ultimate process.
Technical architecture
Here Insert Picture Description
in general, the initial electricity supplier site, on a few basic business subsystems, the site front desk, business reception, system management background, App, M station. Business volume is not great. So, mvc + + database cache. Basically to get.

In fact, solely on the efficiency of development, .net mvc technology architecture LAMP will not be slower than the speed of development. Therefore, some companies, in order to quickly launch its own electronic business platform, will adopt .net framework.

Infrastructure
Here Insert Picture Description
infrastructure level. This is a very simple infrastructure up.
1: Front and M station site, taking into account the availability of traffic and the system will use the basic distributed deployment. Distribution request through a proxy server.
2: Other business subsystems, such as business reception, and management systems are basically stand-alone or master-slave deployments.
3: each DB, Redis services and documents and pictures services, search engine Solr service, master-slave deployments.

Detailed architecture of
Here Insert Picture Description
the overall system architecture inside, there is a more important part of that monitoring system. For example: traffic monitoring, hardware monitoring, system performance monitoring, there is a page on the monitor, which monitors a set of pages and so on. It is an important means to improve the availability of the entire platform, multi-platform, multiple dimensions of monitoring, to ensure availability of the system, once the abnormal, especially in hardware or unusual performance, the monitoring system can immediately issue a warning, it was just Preventive measures.

日志系统与监控系统的解决方案
监控系统主要用于服务器集群的资源和性能监控以及应用异常和性能监控,日志管理等多维度的性能监控分析。一个完善的监控系统和日志系统对于一个系统的重要性不必我多说,总而言之就一句话,只有实时了解各系统的状态,才能保证各系统的稳定。
Here Insert Picture Description
如上图所示,监控平台监控的范围很广,服务器性能及资源,还有应用系统的监控。每个公司都有特定的平台统一监控的需求及解决方案,但是监控平台的任务和作用基本是一致的。

日志:日志是监视程序运行的一种重要的方式,主要有两个目的:1.bug的及时发现和定位,2.显示程序运行状态。正确详细的日志记录能够快速的定位问题。同样,通过查看日志,可以看出程序正在做什么,是不是按预期的设计在执行,所以记录下程序的运行状态是必要的。这里将日志分为两种:1.异常日志,2.运行日志。

我们主要是使用log4net,将各个系统的日志,持久化记录到数据库或者文件中,以方便后续的系统异常监控和性能分析。如何集成log4net,这里不再说明。

日志记录的几个原则:
1:区分日志级别一定要区分清楚,哪些属于error,warning,info等。
2:记录错误的位置,如果是分层系统,一定要在某个层统一处理,例如,我们的mvc架构,都是在各个action中catch异常,并处理,业务层和数据库层这些地方的异常,都是catch到异常后,往上一层抛。
3:日志信息清晰准确有意义,日志尽量详细点,以方便处理。应该记录相关系统,模块,时间,操作人,堆栈信息等。方便后续处理。

监控:监控系统是一个复杂的系统平台,目前有很多的开源产品和平台。不过我们平台小,监控任务和需求少,所以基本都是自己开发,主要有这五个方面:1.系统资源,2.服务器,3.服务,4.应用异常,5.应用性能。
Here Insert Picture Description
系统资源监控:监控各种网络参数和各服务器相关资源(cpu,内存,磁盘读写,网络,访问请求等),保证服务器系统的安全运营;并提供异常通知机制以让系统管理员快速定位/解决存在的各种问题。目前比较流行的应该是zabbix。
服务器监控:主要是监控各个服务器,网络节点,网关,等网络设备,的请求响应是否正常,通过定时服务,定时去ping各个网络节点设备,以确认各网络设备是否正常,,如果哪个网络设备出现异常,则发出消息提醒。
服务监控:指的是各个web服务,图片服务,搜索引擎服务,缓存服务等平台系统的各项服务是否正常运行,可以通过定时服务,每隔一段时间,就去请求相关的服务,确保平台的各项服务正常运行。
应用异常监控:目前我们平台的所有系统的异常记录,都记录在数据库中。通过定时服务,统计分析一段时间之内的异常记录。如果发现有相关重要的模块的系统异常,比如支付,下单模块,频繁发生异常,则立即通知相关人员处理,确保服务正常运行。
应用性能监控:在api接口和各应用的相关位置进行拦截和记录下程序性能(sql性能,或是 程序执行效率)。相关重要模块提供性能预警,提前发现问题。 同时统计相关监控信息并显示给开发的人员,以方便后续的性能分析。

总而言之,一个好的系统架构应该从扩展性、安全性、性能和可靠性来考虑。罗马不是一天建成的,架构适合就行,可以先行之而后优。通过渐进演化的过程,逐步是系统越来越完善。

Published 119 original articles · won praise 27 · views 40000 +

Guess you like

Origin blog.csdn.net/baobingji/article/details/104599826