问题 问答题 简答题

论大规模分布式系统缓存设计策略

大规模分布式系统通常需要利用缓存技术减轻服务器负载、降低网络拥塞、增强系统可扩展性。缓存技术的基本思想是将客户最近经常访问的内容在缓存服务器中存放一个副本,当该内容下次被访问时,不必建立新的数据请求,而是直接由缓存提供。良好的缓存设计,是一个大规模分布式系统能够正常、高效运行的必要前提。在进行大规模分布式系统开发时,必须从一开始就针对应用需求和场景对系统的缓存机制进行全面考虑,设计一个可伸缩的系统缓存架构。

请围绕"大规模分布式系统缓存设计策略"论题,依次从以下3个方面进行论述:

①概要叙述你参与实施的大规模分布式系统开发项目及你所担任的主要工作。

②从不同的用途和应用场景考虑,请详细阐述至少两种常见的缓存工作模式,并说明每种工作模式的适应场景。

③阐述你在设计大规模分布式系统的缓存机制时遇到了哪些问题,如何解决。

答案

参考答案:

写作要点

①论文中要具体介绍项目的总体需求(特别是应用需求中对缓存机制的要求)、系统的逻辑与物理架构、采用的技术等内容和担任的买际工作。

②从不同的用途和应用场景来考虑,大体上可以将缓存分为3种工作模式,即单实例缓存模式(SingleInstance)、复制模式(Replication Cache)和分区模式(Partition Cache)。每种工作模式都有其适应的场景和优缺点。

单实例模式。单实例模式是一种较为简单的缓存模式,多个应用服务器共享一个中央的缓存服务器。通过共享缓存的数据,能够极大提高系统的性能。该模式的主要限制在于缓存服务器的内存大小和节点增加之后服务器的处理能力和网络带宽。该模式的适应场景是:对缓存的要求比较简单;系统的吞吐量和数据量不大;性能要求不高。

复制模式。复制模式将缓存的数据复制到多台机器上,对于单一缓存服务器性能出现问题的情况下,可以通过缓存复制的方式将压力分解到多个缓存服务器。该模式的工作原理是:缓存客户端可以访问自己的缓存服务器,多个缓存服务器之间的数据是彼此同步的,对于性能要求更高的场景,这样的部署架构能够获得更高的吞吐能力。该模式的适应场景是:数据量不是特别大;需要极高的性能;数据改动的频率不是特别大。

分区模式。当需要缓存的数据已经超过一台服务器的内存上限时,可以考虑采用分区模式对数据进行线性缩放,也就是通过增加缓存服务器来解决数据增长和压力增加的情况。在分区模式中,其架构是无分享架构(Shared Nothing Architecture,SNA.,每个节点之间数据彼此独立,一个节点出现故障后不会影响到其他节点。在出现某个节点宕机或者其他故障的情况下,致使这部分的分区缓存无法使用,并不妨碍其他数据节点数据的正常工作。该模式的适应场景是:总体数据量较大,已经超出了单个缓存服务器的内存上限;系统缓存要求具有很大的可伸缩性;客户端数量庞大,单个客户端对缓存数据的数据量要求不大。

③进行大规模分布式系统缓存机制设计时可能遇到的问题包括如何缓存服务器的工作模式选择;高可用性的设计考虑;缓存一致性与分布式算法;对象状态同步的考虑;缓存钝化/激活/过期和初始化,等等。

完形填空
完形填空。
     During Christmas break from college, a young man wanted to borrow his father's car to drive to a
New Year's Eve   1   to be held in Vermont. The father was   2   about the son hitting one of the
roadblocks that people set up all over the place on New Year's Eve. The   3   that was reached was that
the son would be allowed to use the car, but he would not drink at all.
     So he drove to Vermont, got completely   4   and attempted to drive home. On the way home he hit a
roadblock. He was told to   5   the car and stand in a line of people that were being given the infamous
sobriety (not drunk)  6  . However, the policeman   7   him out. He was   8   standing off to the side while
the others were   9   the police officer how well they could walk a   10   line, etc.
     At 7:00 a.m., his father got up to answer the  11  . There were   12   policemen there. They asked him
if he was the   13   of that red FIAT. He replied, "Yes, I am," One of the policemen asked him if he was
driving the car the evening before and he said that his son had been the driver.
     When the young man   14   himself in front of the policemen, he knew he was in some sort of  15  .
Upon questioning, he   16   that he was driving the car, but when asked if he had been   17  , he said,
"No!" When the policemen asked if he could see his car, he was unable to remember the  18 . He said
that it was in the garage.
     And when the four of them walked out to look at the car,instead of looking at the car he had driven
the   19   before, they saw a  20   car parked there.
( )1. A. party      
( )2. A. sure      
( )3. A. suggestion
( )4. A. excited    
( )5. A. stop      
( )6. A. punishment
( )7. A. gave      
( )8. A. considered
( )9. A. showing    
( )10. A. long      
( )11. A. telephone
( )12. A. two      
( )13. A. manager  
( )14. A. stood    
( )15. A. trouble  
( )16. A. believed  
( )17. A. driving  
( )18. A. drive    
( )19. A. day      
( )20. A. similar  
B. meeting    
B. worried    
B. condition  
B. tired      
B. get out of  
B. test        
B. made        
B. required    
B. explaining  
B. straight    
B. call        
B. many        
B. father      
B. found      
B. test        
B. told        
B. hurting    
B. test        
B. morning    
B. familiar    
C. concert    
C. curious    
C. conclusion
C. drunk      
C. drive      
C. education  
C. missed    
C. suggested  
C. asking    
C. calm      
C. doorbell  
C. four      
C. student    
C. put        
C. danger    
C. admitted  
C. missing    
C. time      
C. afternoon  
C. police    
D. sports meeting
D. anxious        
D. agreement      
D. pleased        
D. get into      
D. talk          
D. found          
D. left          
D. telling        
D. direct        
D. question      
D. one            
D. owner          
D. took          
D. accident      
D. said          
D. drinking      
D. line          
D. night          
D. damaged        
名词解释