系统/服务器优化

3 篇文章 0 订阅

(Cache,Asynchronous,Concurrent)

前端性能优化
  1. 网页瘦身,降低带宽消耗。
    • 尽量少的使用图片及大体积的东西。
    • 合并js、css文件以减少请求加载次数
  2. 页面静态化
  3. DNS负载均衡
    • CDN,Content Delivery Network,即内容分发网络
后台性能优化
  1. 数据库部分
    • 数据冗余
      将数据库的数据冗余处理,以减少大表连接查询
    • 数据镜像
    • 数据分区
  2. 逻辑
Cache
  1. page caching
  2. action caching
    • Action caching is dependent on urls.
  3. fragment caching
    • Fragment caching is dependent on the view being rendered.
    • 片段缓存(Fragment caching)就是缓存已渲染的HTML片段进Rails.cache,(P: Rails provides a ‘cache’ view helper for this. It’s most basic form takes no arguments besides a block.)
<%= cache "#test{@test.id}-{@test.updated_at}" do %>
    <div>
        <b><%= @test.title %></b>
    </div>
    ...
<% end %>

All cached content are stored in the Rails.cache(except page caching). Page caching are stored as HTML on disk.

Tip:

  • 把握缓存粒度,以降低expired,提高命中率为目标
  • 数据一致性
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值