定制 dmk/mkvarnish 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dmk/mkvarnish

Composer 安装命令:

composer require dmk/mkvarnish

包简介

Varnish extension for TYPO3

README 文档

README

TYPO3 compatibility Latest Stable Version Total Downloads Build Status License

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. A high level overview of what Varnish does can be read on varnish-cache.org

Introduction

What does it do?

This extension tells Varnish about TYPO3 insights of a page to allow Varnish make proper caching decisions based on those information. It informs Varnish to invalidate the cache as soon as the content is changed through the TYPO3 backend.

Features

  • ready to use configration for Varnish and TYPO3
  • Varnish based caching for all pages using cache-tags
  • TYPO3 clear cache hook to clear cache or smart ban relevant pages in Varnish
  • Provide a page content error handler which does not bypass Varnish like the dafault handler does. This way 404 handling leverages Varnish too.

Background

  • the extension sets config.sendCacheHeaders = 1 to enable TYPO3 core function which sends appropriate cache headers to Varnish
  • send "X-Cache-Tags" HTTP Header which is used to issue PURGE command against
  • send appropriate PURGE Command to Varnish during a TYPO3 clearCache action
  • those headers are used for Varnish processing only and get removed afterwards

Installation

We recommend the installation via composer. Maybe you can use our TYPO3-Composer-Webroot Project

From project root you need to run

composer require dmk/mkvarnish

Requirements

  • you should make yourself familiar with Varnish and how you want to implement Varnish in your specific setup.
  • Varnish has to be up and running. You can find a sample configuration in EXT:mkvarnish/Configuration/Varnish/default-4.vcl. Make sure to change or remove the Debug ID at the beginning of sub vcl_recv. Furthermore you should check the last comment in sub vcl_recv and act accordingly.
  • requests to all static files should send appropriate expires headers

Configuration

  • set $TYPO3_CONF_VARS['SYS']['reverseProxyIP'] to the IP address which is used by Varnish to connect to your Webserver or enable the caching in the extension configuration by set sendCacheHeaders to Force Enabled.
  • do not use sessions, the fe_typo_user cookie will disable the caching
  • dont set no_cache=1
  • the use of *_INT objects will disable the cache too, dont use it (You can find them with the Admin Panel.)
  • Configure the page content error handler in the site configuration like this instead of the default "Page" handler if your 404 page is cachable through Varnish. Otherwise the content won't be cached/delivered through Varnish:
    errorHandling:
      -
        errorHandler: PHP
        errorPhpClassFQCN: DMK\Mkvarnish\Error\PageErrorHandler\PageContentErrorHandler
        errorCode: '404'
        errorContentSource: 't3://page?uid=123'

USER_INT objects

Sometimes there is a page that should be cached through Varnish but contains USER_INT plugins, for example a news detail page with a comment plugin. To migrate such a plugin to a USER plugin might be a hassle or even impossible. But there is a easy solution: The plugin needs to be lazy loaded with Ajax. To achieve this you can use the Ajax Content Renderer feature of mktools.

dmk/mkvarnish 适用场景与选型建议

dmk/mkvarnish 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.78k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cache」 「extension」 「varnish」 「typo3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dmk/mkvarnish 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dmk/mkvarnish 我们能提供哪些服务?
定制开发 / 二次开发

基于 dmk/mkvarnish 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 21
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2017-11-08