High TTFB on sites with a lot of content
-
We currently do not have TranslatePress enabled on the site because it is causing a really high time to first byte. Our TTFB is generally around 1 second (still rather high) but when we enable TranslatePress the TTFB jumps to over 4 seconds.
This is due to a lot of content, products, etc on our website.
We thought we had the problem solved with the following code:
<?php /* Plugin Name: TranslatePress - Disable Gettext Translation on default language Plugin URI: https://translatepress.com/ Description: Disable Gettext Translation on default language to reduce page load time Version: 1.0.0 Author: Cozmoslabs, Razvan Mocanu Author URI: https://cozmoslabs.com/ License: GPL2 */ if ( class_exists( 'TRP_Translate_Press' ) ) { add_filter( 'plugins_loaded', 'trpc_disable_gettext_translation', 10 ); function trpc_disable_gettext_translation( $run_or_not ){ global $TRP_LANGUAGE; $trp = TRP_Translate_Press::get_trp_instance(); $trp_settings = $trp->get_component( 'settings' ); $settings = $trp_settings->get_settings(); $default_language = $settings["default-language"]; if ( $TRP_LANGUAGE == $default_language ) { $translation_manager = $trp->get_component( 'translation_manager' ); $translation_render = $trp->get_component( 'translation_render' ); remove_action( 'init', array( $translation_manager, 'create_gettext_translated_global' ) ); remove_action( 'admin_init', array( $translation_manager, 'create_gettext_translated_global' ) ); remove_action( 'init', array( $translation_manager, 'apply_gettext_filter_on_frontend' ) ); remove_action( 'admin_init', array( $translation_manager, 'apply_gettext_filter' ) ); remove_action( 'shutdown', array( $translation_manager, 'machine_translate_gettext' ) ); remove_action( 'date_i18n', array( $translation_manager, 'handle_date_i18n_function_for_gettext' ) ); remove_action( 'clean_url', array( $translation_manager, 'trp_strip_gettext_tags_from_esc_url' ) ); remove_action( 'sanitize_title', array( $translation_manager, 'trp_sanitize_title' ) ); remove_action( 'gettext_with_context', array( $translation_render, 'fix_wptexturize_characters' ) ); } return $run_or_not; } }
Unfortunately, our times haven’t decreased significantly.
We did make a minor code change to the original source to check to see if TranslatePress is active. Otherwise we have to be very careful when we activate/deactivate plugins because a fatal error can be generated.
This is a multi-site install running 4 websites. Server has 8GB of RAM and 4 processors running PHP 7.x so I don’t think it is server issue.
Any suggestions would be appreciated.
The page I need help with: [log in to see the link]
- The topic ‘High TTFB on sites with a lot of content’ is closed to new replies.