Giter Club home page Giter Club logo

mkvarnish's Introduction

MK VARNISH

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

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.)

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.

mkvarnish's People

Contributors

darthnorman avatar dmk-ralf-urban avatar hannesbochmann avatar imajaris avatar rengaw83 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mkvarnish's Issues

This is a Question, no ISSUE

1.) Does this Extension support Varnish 6.1?
2.) Does this Extension wipe the cache of pages which got updated ion the Typo3 Backend automaticaly?
3.) Does this Extension support forcing caching?
3.1) Example: I have a page which Typo3 says its not cachable but it indeed is, can I somewhere force it to be cached?

Thanks for answering, would love to implement a good Varnish Cache!

more generic approach for clearing cache in varnish when TYPO3 cache is cleared

The current approach is the following: When a clear cache command is issued in the backend the complete varnish cache is flushed. This is the first problem. The cache command can be like "cacheTag:myCacheTag" etc. and not just system, all and pages. In such a case it's bad if the complete cache is flushed.
The next problem is as soon as somebody clears the cache in PHP code with the cache manager or directly in the cache, varnish won't get updated as no clear cache command is issued.

The following approach is more low level and should be much better/more generic: A custom cache backend for Varnish should be implemented, providing methods to flush the complete cache and flush the cache by tag. This cache backend should be registered for all possible cache groups automatically if varnish is in use. This way it doesn't matter how the cache is cleared as long as the TYPO3 API is used (cache manager).

What needs to be checked: Is the cache_pages cache (or some other relevant cache) cleared at some point without using the cache manager for clearing the cache for groups? If yes, varnish should get the clear cache command, too. I'm not sure how this could be done as there seems to be no appropriate hook.

As a bonus the cache backend for varnish could also provide the methods for retrieving data from varnish. This way the cache backend could be used for other scenarios as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.