Configure Tweakwise API Timeout Settings
The Tweakwise API timeout mechanism controls how long your Magento 2 storefront waits for responses from Tweakwise before timing out. Properly configured timeouts ensure that slow or temporarily unreachable API responses don't block your storefront from rendering pages.
This guide walks you through configuring two key timeout settings: Maximum connection time and Maximum request time.
Prerequisites
magento2tweakwiseplugin v11.2.1 or higher installed
Step 1: Verify Plugin Version
Before configuring timeout settings, ensure you're running the required version:
- In your Magento admin dashboard, go to System > Tools > System Report.
- Check that
magento2-tweakwiseis v11.2.1 or higher. -
If your version is older, update the plugin first by running:
composer update tweakwise/magento2-tweakwise - After updating, flush the Magento cache.
Step 2: Access Tweakwise Configuration
- Log in to your Magento admin dashboard.
- Navigate to Stores > Configuration from the left sidebar.
- In the left menu under Catalog, click Tweakwise.
- Select the General tab if it's not already open.
Step 3: Configure Connection Timeout
The Maximum connection time setting controls how long Magento waits to establish a TCP connection with the Tweakwise API server.
- Locate the Maximum connection time field.
- Enter a value in seconds (default: 1 second).
- Recommended values:
- 1 second (default): suitable for most deployments with stable network connectivity
- 2-3 seconds: use if you experience frequent connection timeouts on a slower network
- Less than 1 second: not recommended; may cause failures under normal load
Step 4: Configure Request Timeout
The Maximum request time setting controls the total time allowed for a complete Tweakwise API request, from connection through response.
- Locate the Maximum request time field.
- Enter a value in seconds (default: 5 seconds).
- Recommended values:
- 5 seconds (default): suitable for most deployments
- 10 seconds: use if you have a big catalog
- Less than 5 seconds: not recommended; may cause requests to fail unnecessarily
Important: The request timeout must be greater than the connection timeout.
Step 5: Save Configuration
- Click the Save Config button at the top right of the page.
- Wait for the confirmation message: "You saved the configuration."
-
Flush the Magento cache by going to System > Cache Management and clicking Flush Magento Cache, or run:
php bin/magento cache:flush
Scope and Store Views
Timeout settings can be configured per store view if your Magento installation uses multiple stores:
- Use the Store View dropdown at the top left of the configuration page.
- Select a specific store view to apply unique timeout values.
- Each store view inherits the global configuration by default unless you customize it.
Troubleshooting
Pages are timing out or loading slowly:
- Increase the Maximum request time to 10 seconds
- Check your network connectivity to the Tweakwise API
- Review Tweakwise API status at your Tweakwise dashboard
Requests succeed but are very slow:
- Monitor the Maximum connection time separately from request time
- Increase connection timeout if initial handshakes are failing
- Consider upgrading your hosting plan for better network performance
Changes don't take effect:
- Verify the cache was flushed with
php bin/magento cache:flush - Ensure you're logged into the correct store view
- Clear your browser cache manually (Ctrl+Shift+Delete)
Best Practices
- Test on staging first: Always test timeout configuration changes in a staging environment before applying them to production.
- Start with defaults: Only adjust timeouts if you experience issues. The defaults work for most use cases.
- Monitor after changes: After updating timeout values, monitor your logs for the next 24-48 hours to ensure stability.
- Document your changes: Keep a record of why you modified timeout settings in case you need to troubleshoot later.
- Balance performance and reliability: Lower timeouts improve perceived performance but increase failure risk. Higher timeouts are more reliable but slower.
Updated 33 minutes ago