Форумы
The great place to discuss topics with other users
ready-to-follow Sngine optimization checklist
'Sngine Performance Optimization Checklist
1. Server & PHP Setup
-
Upgrade PHP: Use PHP 8.2+ for better performance.
-
Enable OPcache:
-
Edit
php.ini:
-
-
Enable Gzip/Brotli:
-
Nginx:
-
Apache:
-
-
HTTP/2: Enable in your web server for faster multiplexed requests.
-
Use SSD hosting or VPS over shared hosting.
2. Database Optimization
-
Index common columns:
-
users.id,posts.id,posts.user_id,likes.post_id,comments.post_id
-
-
Clean old logs:
-
In
x_log,sessions,notifications, remove outdated entries.
-
-
Optimize queries:
-
Check slow queries using MySQL
slow_query_log. -
Example:
-
Add indexes if necessary.
-
-
Use proper data types:
-
INTfor IDs,VARCHAR(100)for small strings instead ofTEXT.
-
3. Sngine Configuration & Code
-
Feed Optimization:
-
Limit posts per page:
Edit/content/themes/unity+/controllers/posts.php:
-
-
Use AJAX Loading:
-
Infinite scroll or “Load More” instead of loading all posts at once.
-
-
Disable unused plugins/modules:
-
Check
/content/plugins/and/content/themes/unity+/controllers/modules/.
-
-
Reduce repeated queries:
-
Cache frequently accessed data like:
-
Logged-in user info
-
Notifications
-
Trending posts
-
-
4. Caching
-
Page caching:
-
Use LiteSpeed Cache if server supports it, or Nginx FastCGI cache.
-
-
Query caching:
-
Use Redis or Memcached for caching results of frequent queries.
-
-
Object caching:
-
Cache
user,post,notificationsobjects in memory.
-
5. Asset Optimization
-
Minify JS & CSS:
-
Use tools like UglifyJS, CSSNano, or built-in minifiers.
-
-
Combine files:
-
Reduce HTTP requests by merging small JS/CSS files.
-
-
Use WebP for images:
-
Replace JPG/PNG with WebP.
-
-
Lazy load images:
-
Example in templates:
-
-
Compress images:
-
Use
tinypng.comor similar.
-
6. Content Delivery Network (CDN)
-
Use Cloudflare, StackPath, or BunnyCDN.
-
Serve
/uploads/and static assets (CSS/JS) through CDN.
7. Monitoring & Analysis
-
PageSpeed & Lighthouse:
-
Test regularly for:
-
LCP (Largest Contentful Paint)
-
FCP (First Contentful Paint)
-
TTI (Time to Interactive)
-
-
-
Server Monitoring:
-
Use New Relic, PHP-FPM status, or htop to monitor CPU/RAM usage.
-
-
Database Monitoring:
-
Monitor slow queries and high-load queries.
-
8. Optional Advanced Tweaks
-
Queue system for heavy tasks:
-
Notifications, emails → Redis + Laravel Queue or RabbitMQ.
-
-
Varnish Cache:
-
Full-page caching to reduce server load.
-
-
Database replication:
-
For very high traffic, separate read/write queries.
-
✅ Extra Tip:
Enable lazy loading for feeds, notifications, and comments—these are often the heaviest parts of Sngine pages. This alone can reduce initial page load by 50–70%.
Improving Sngine performance involves both server-side and client-side optimizations since Sngine is PHP/MySQL-based and can be heavy if not optimized. Here’s a step-by-step guide:
1. Optimize Your Hosting Environment
-
Choose a fast server: Use VPS or dedicated hosting instead of shared hosting.
-
PHP version: Use the latest stable PHP (e.g., PHP 8.2+) for performance improvements.
-
Database: MySQL/MariaDB should have optimized settings (
innodb_buffer_pool_size,query_cache_size). -
Enable OPcache: This caches PHP bytecode for faster execution.
-
SSL & HTTP/2: Faster HTTPS connections improve load times.
2. Optimize Database
-
Index frequently queried fields: e.g., posts, users, likes.
-
Clean old data: Delete old logs, sessions, and temporary files.
-
Use proper data types: Avoid
TEXTorVARCHAR(255)when smaller fields suffice. -
Optimize queries: Use
EXPLAINto check slow queries and add indexes as needed.
3. Enable Caching
-
Page caching: Use tools like LiteSpeed Cache or NGINX FastCGI cache.
-
Database query caching: Use Redis or Memcached to cache frequent queries.
-
Object caching: Cache objects like user info, notifications, and posts.
4. Optimize Assets
-
Minify CSS & JS: Use tools to reduce size.
-
Combine files: Reduce HTTP requests.
-
Use Gzip/Brotli: Enable compression on the server.
-
Lazy load images: Especially in feeds or media-heavy pages.
-
Use WebP for images to reduce size.
5. Optimize Sngine Code
-
Limit feed queries: Use
LIMITandOFFSETefficiently. -
Use AJAX for loading posts: Instead of loading all posts at once.
-
Reduce unnecessary queries: Avoid repeated queries in loops.
-
Check modules/plugins: Disable any unused plugins to reduce overhead.
6. Use a Content Delivery Network (CDN)
-
Serve static files (images, JS, CSS) through a CDN.
-
Offload traffic from your server and reduce latency for global users.
7. Monitor and Test
-
Use Google PageSpeed Insights, GTmetrix, or Lighthouse.
-
Identify slow queries using MySQL slow query log.
-
Monitor server performance with tools like New Relic or PHP-FPM status.
8. Optional Advanced Tweaks
-
Varnish Cache: For full-page caching.
-
Memcached/Redis: For session caching.
-
Database replication: If you have very high traffic, consider read-replicas.
-
Queue system: Offload heavy tasks (like notifications or emails) to a queue system (Redis + Laravel Queue or RabbitMQ).