User Tools

Site Tools


new_rotation_faq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
new_rotation_faq [2016/04/01 17:32]
admin [Custom Sitemaps]
new_rotation_faq [2017/10/16 12:23] (current)
Line 4: Line 4:
  
 Each gallery can be assigned to more then 1 group. You can notice it while gallery edit: there are 2 select fields for groups - main and ext. Rotation - groups counts using main group so we can see real amount of galleries in DB, while Rotation - list thumbs shows galleries using Ext groups , the way you'll see it on site. Each gallery can be assigned to more then 1 group. You can notice it while gallery edit: there are 2 select fields for groups - main and ext. Rotation - groups counts using main group so we can see real amount of galleries in DB, while Rotation - list thumbs shows galleries using Ext groups , the way you'll see it on site.
 +
 +
 +===== Where pages are stored =====
 +
 +With New Rotation you get a lot of pages. Old style rotation was like you create a finite number of pages (usually up to ten)
 +
 +Pretty common situation: 300 categories, 7 pages in each, 3 ways to sort galleries inside category (CTR, date, duration) - it's 6300 pages.
 +
 +It doesn'​t make sense to create those pages each minute so script creates it when someone requests it, stores in cache and uses cached version until it expires.
 +
 +Thus we have 2 points to remember:
 +
 +1. It takes time to create pages. if cache is empty it is called 'cold startup',​ we have to "warm up" cache , ie create some mostly visited pages.
 +
 +2. Once cache is up it doesn'​t really matters how many visitors you have as it almost does not consume any resources to give away a page from cache. ​
 +
 +
 +Thus if you have 1 site with  50k or 500k traffic - it doesn'​t affect your server load too much as pages in most case will be cached. But if you have 5 sites with 10k traffic on each - it won't be the same at 1 site with 50k traffic as we have to create a full set of pages for each site.
 +
 +
 +Beside that your layout affects load: ie if you have 3 options to sort content it will be "total amount of pages * 3", while if you have just 2 ways to soft it (it depends design actually , ether you have a link to another way to soft it or not) - you'll get less page to create => less load on server.
  
 ===== Thumbs (Galleries) are not getting deleted ===== ===== Thumbs (Galleries) are not getting deleted =====
Line 10: Line 31:
   * that's why since update 46 thumbs won't be actually deleted once you press '​Delete',​ instead those thumbs will be marked as '​Marked for deletion'​ and once every 10 minutes cron script will check for those thumbs and actually delete it.   * that's why since update 46 thumbs won't be actually deleted once you press '​Delete',​ instead those thumbs will be marked as '​Marked for deletion'​ and once every 10 minutes cron script will check for those thumbs and actually delete it.
   * you want to force that action you have to run following command in SSG   * you want to force that action you have to run following command in SSG
-  * <​code>​cd /​PATH_TO_/​scj/​bin/;​ env HTTP_HOST=yourdomain.com php rot.php process_deleted=true </​code>​+  * <​code>​cd /​PATH_TO_/​scj/​bin/;​ env HTTP_HOST=yourdomain.com php rotation.php process_deleted=true </​code>​
   * there'​s one exclusion - if you delete thumbs in 'List Thumbs'​ and total amount of thumbs being deleted is less then 30.   * there'​s one exclusion - if you delete thumbs in 'List Thumbs'​ and total amount of thumbs being deleted is less then 30.
  
Line 255: Line 276:
  
  
 +===== Why order of thumbs differs in admin area and on site =====
 +
 +In most cases order should be the same order but you should keep in mind few settings:
 +
 +  - Test positions start (do not test new thumbs at positions higher then ) ie if a thumb is considered as new if won't be shown in the top position on site, but you can see it the top position in admin are
 +  - % of test places on page (% of places on each page where we test NEW thumbs ) some thumbs might not be in the same order as well 
 +
 +
 +===== How to import a large cvs =====
 +
 +Note, with version 2.X you can add as large cvs as you want. Written below relates to 1.X only.
 +
 +There'​s a logical issue with large cvss. 
 +A file can be too large to be uploaded with browser, it can take too much time to process it that causes timeouts and so on.
 +
 +So some people decided to use importsets to inport large file and it would be file if they don't forget about it.
 +
 +A common issue that 90% forget about those importsets and the script tries to import let's say 500 000 galleries every hour and that takes a lot of resources every hour.
 +
 +Besides that when you import a large file at once it creates a spike in server load that might cause a notable slow down in server'​s performance. ​
 +
 +So here's a good way to import large files:
 +
 +  * create a file called cut.php ​
 +
 +<​code>​
 +
 +<?php
 +
 +error_reporting(E_ALL & ~E_NOTICE);
 +
 +if (!$_GET['​file'​]) die("​\n You have to pass file=... parameter in URL");
 +if (!file_exists($_GET['​file'​])) die("​\n File {$_GET['​file'​]} does NOT exists. Check path. ");
 +if (!is_writeable($_GET['​file'​])) die("​\n File {$_GET['​file'​]} is NOT writeable. Set 666 permissions. ");
 +
 +if (!file_exists('​./​tmp.file'​) or !is_writeable('​./​tmp.file'​)) die("​\n File tmp.file does not exists OR is NOT writeable. Set 666 permissions. ");
 +
 +echo passthru("​head -n500 {$_GET['​file'​]} ");
 +if (!$_GET['​test'​]) exec("​tail -n +500 {$_GET['​file'​]} > tmp.file; cp tmp.file {$_GET['​file'​]} ");
 +
 +</​code>​
 +
 +  * upload a cvs file to the same location and chmod 666 it
 +  * Upload emtry file tmp.file and chmod 666 it as well
 +  * Add ImportSet with URL http://​yourdomain/​path_to/​cut.php?​file=cvs_file_name&​test=true
 +  * Click Test and select fields
 +  * cut.php outputs ​ 500 lines and cuts out thoses 500 files from cvs file. So on each run you'll add 500 new galleries. ​ Note, you can change this amount in the code above.
 +  * &​test=true means "do not cut out those 500 lines"​. That's necessary for test purposes.later you should remove it and it should be like http://​yourdomain/​path_to/​cut.php?​file=cvs_file_name
 +
 +That's it.
 +
 +So this was an entire large cvs file will be addded and even if you forget to remove that import set it won't create any load on a server.
 +
 +
 +===== Lazy load, load on scroll, pinterest and so on  =====
 +
 +The base idea here is to load some content when user scrolls down the end of a page. So user doesn'​t have to reload an entire page but gets "​infinite"​ scroll instead. ​
 +
 +Let's sat we have a template "​index"​ with 50 thumbs
 +
 +<​code>​
 +<thumb num=1-50>​
 +<a href='/​...'><​img src='<​!--THUMB_URL-->'></​a>​
 +</​thumb>​
 +</​code>​
 +
 +
 +In this example we use jquery.wookmark JS library (example here http://​demo.smartcj.com/​scroll/​) Actually there are a plenty of libs like this one
 +
 +When user reaches the end of a page we need to load some new content so here's an URL for it
 +
 +  var P_BASE = '/?​force_template=index_scroll_ajax&​page=';​
 +  ​
 +  ​
 +as you can see we load template "​index_scroll_ajax"​ with a variable &​page=.. So what jquery.wookmark does it changing that last parameter &page= each time loading /?​force_template=index_scroll_ajax&​page=2,​ /?​force_template=index_scroll_ajax&​page=3 and so on
 +
 +Template index_scroll_ajax where we output 10 thumbs
 +
 +<​code>​
 +<thumb num=1-10>​
 +<a href='/​...'><​img src='<​!--THUMB_URL-->'></​a>​
 +</​thumb>​
 +</​code>​
 +
 +
 +
 +===== Thumbs\galleries are not being deleted =====
 +
 +Thumbs are not deleted right away when you click "​delete"​ in admin area because we need to reload a page right away (to avoid timeout). So instead щи being deleted thumbs are marked as 'to delete'​. Every 10 minutes rotation.php crontab job checks for thumbs with this mark and actually delete them.
 +
 +if you want to force deletion:
 +
 +<​code>​cd /​PATH_TO_/​scj/​bin/;​ env HTTP_HOST=yourdomain.com php rotation.php process_deleted=true </​code>​
 +
 +
 +===== It does not grab this gallery ​ =====
 +
 +Some galleries might have some peculiarities and are created in a way that the script can not download it.  We try to implement it as good as we can but if there'​s a gallery you'd like to add but the script can not parse it - you can use so called '​gateway'​ for it:
 +
 +  * let's say a gallery http://​gallery/​ contains an image http://​gallery/​image.jpg but the script can not see it
 +  * we create file http://​your_server/​gate.php
 +  * and import the gallery ​ as http://​your_server/​gate.php?​url=http://​gallery/ ​
 +  * your script gate.php gets URL,  parses the real gallery and outputs it in a regular way , for example ​
 +
 +<​code>​
 +<a href='​http://​image1'><​img src='​http://​thumb1'></​a>​
 +<a href='​http://​image2'><​img src='​http://​thumb2'></​a>​
 +and so on
 +</​code>​
 +
 +**ImportSets**
 +
 +Let's say we have importset http://​sponsor/​dump.php that outputs something like 
 +
 +url|thumb_url|some_id
 +
 +and we'd like to replace some_id some something more meaningful like http://​test/​modified_id
 +
 +
 +  * gate.php?​url=http://​sponsor/​dump.php
 +  * the gate gets URL, downloads it and replaces some_id with http://​test/​modified_id and outputs, so the script get's dump in a way you want it to be
 +  * we add gate.php?​url=http://​sponsor/​dump.php in import set instead of http://​sponsor/​dump.php
  
  
new_rotation_faq.1459531950.txt.gz · Last modified: 2016/04/01 17:32 by admin