Copyright © 2012 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.
EduVideo.org
"I am reposting this issue in KALTURACE because it may have been an issue with server"
I have everything setup and running with KalturaCE and the server is working fine.
The issue here I am having is unclassified.
When I play two videos together from my site, the second video which I played later doesn't start until the first completes its buffering.
I did some HTTP watch and came to know that,
both of the entries request the file with the URL as follows,
/kalturace/p/1/sp/100/flvclipper/entry_id/xxxxxx/flavor/1/version/100000
so the first video which I played receives a 302 redirect response to the URL as follows,
/kalturace/p/1/sp/100/flvclipper/entry_id/xxxxxxx/flavor/1/version/100000/a.flv?novar=0
and starts buffering and playing. While the second video which I started later just wait for a response till the first video end its buffering and then the second video receives its 302 redirect and start buffering
My question is, why can't both videos buffer concurrently? and Obviously this is what I require.
Your help is highly anticipated and much welcome.
Moreover, on the issue tracker of Kaltura Drupal Module on drupal.org
G Robot advised me as follows,
Would be interesting to know if this affects multiple client browsers on the same machine, multiple client machines, etc.
Here are a couple of guesses based on the assertion that the client is submitting it's requests to Kaltura and then the wait happens server side.
The obvious candidate in the Apache space is MaxClients. If that apache setting is low, then the server may be dropping your connections into its backlog until the first connection is completed. You can test this using regular large files which take some time to download on the server - that will establish whether it's KalturaCE or Apache which is causing the issue. To see this you'd either need a site which is already sitting at max for MaxClients (ie, not an unused dev site), or a very low MaxClients setting (like, 1!).
Another possible cause would be a mysql query lock. If KalturaCE's SQL is locking a table until the first request is completed, then the second request might hang like this. I'm not familiar enough with CE to suggest that this is the case, but you could easily debug using mtop on the server during the request to see if this is what's actually happening.
Please post URL of any discussion you create on kaltura.org so we can follow there too!
Cheers
Therefore I am off to the suggestions given above and would be posting back till I resolve the said issue.
The session suggestion is valid too, but to resolve that you'd need to close the session before the streaming initiates, not once it's completed.
I can't find your question on StackOverflow. Want to post a link here, and let us know how the suggestions I made fared? Would be interesting to see what other ideas were put forward.
Drupal.org issue: http://drupal.org/node/1002144 (which I closed as I believe this is not a Drupal issue, but adding URL for reference)
Earlier post by yourself: http://www.kaltura.org/videos-not-playing-simultaneously
I played over with Apache and incresed the number as follows and I didn't get the expected result,
From
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 15
MaxRequestsPerChild 1000
To
StartServers 2
MinSpareServers 1
MaxSpareServers 3
MaxClients 70
MaxRequestsPerChild 3000
Also, increasing the numbers put processes to use SWAP.
Suggestion for the PHP session closing is what I am trying to do next (Using Session closing before streaming starts).
MySQL, I think MySQL table locks are not valid here since its surely a file locking / sharing problem or apache request serving problem.
I tried opening two vids simultaneously with different browsers and it worked as desired, buffering together. But opening two vids from same browser waits for the first one.
I am using VPS.NET's single node which is pretty limited (386M RAM, 0.6 GHZ processing speed). And I am believing its basically hardware limitation which is hindering Apache to server multiple request from a single client.
Stackoverflow link: http://stackoverflow.com/questions/4479560/does-apache-php-blocks-a-sing...
Since you say that if you download from different browsers it works well, this actually sounds like a client side browser limitation.
There is a limitation of parallel objects requested from the same domain.
More information - http://www.websiteoptimization.com/speed/tweak/parallel/
We use a technique to overcome this on the editors side where you can define multiple subdomains that redirect to the same domain and ask the editors to append a number to the subdomain (so www0, www1, www2, etc. are all redirecting to same www subdomain).
To test this is actually the problem, try this:
Define in your apache conf ServerAlias www0.mydomain.com (replace with whatever) and then point your browser as follow:
www.mydomain.com /kalturace/p/1/sp/100/flvclipper/entry_id/xxxxxx/flavor/1/version/100000
www0.mydomain.com /kalturace/p/1/sp/100/flvclipper/entry_id/xxxxxx/flavor/1/version/100000
If that works, then the problem you have is with the client browser limitation and not in the server.
Let us know how it works (or if it didn't).
Check out the hashURLforMultipalDomains in the URLProccessing class used by the editors.
That's a pretty different tip and I am surely going to test it out and revert back to you people.
I am afraid dear it didn't work.
I sat up different server aliases and tried to download the files simultaneously but it didn't work.
MyTop showed two different connections made for each request but one after each other i.e after the first request ended.
I also increased my hardware resources to 1G RAM and around 1.1Ghz Processing speed and changing apache config accordingly as follows,
StartServers 5
MinSpareServers 5
MaxSpareServers 8
MaxClients 100
MaxRequestsPerChild 5000
but it all didn't work.
I am finding myself in no man's land.
@Kalturian, Is it a normal behavior from Kaltura or I being an exception?
Looking forward to your reply.
Dear Kalturian,
I would be very happy if you could guide me using URLProcessing Class in KDP.
I am using kdp 2.5 and I have the source setup for 2.6 in flex builder.
Just need your clue where to start.
Also in the sample page "index.php" of KDP 2.6 i see a flashvar "disableurlhashing=true" .
I tried disableurlhashing=false but no results.
Please do respond.
Does increase in hardware resources would change this behavior?
By the grace of Almighty Allah, atlast I did it.
Though did it in probably an indecent way but it worked for me.
The track I followed was as follows,
NOTE: I am using KalturaCE 1.5 and KDP 2.5
Having the very very first advice at stackoverflow and suggestions here from GRobot and Kalturian in mind.
With the help of HTTP watch I traced that every time when flvclipper services are called to serve a flv file from the server it sends a redirect to the client which gave me a clue to replace the logic of of redirection in a way that it can replace subdomains for a particular session.
So to add different subdomains to the redirection URL of flv file I did as follows.
In MyKalturCEDirectory/kaltura/alpha/apps/kaltura/modules/keditorservices/actions/flvclipperAction.class.php
I put the following code before sending redirect headers to the client at line 272,
session_start();
if(isset($_SESSION['subDomainPostFix']))
$_SESSION['subDomainPostFix'] = $_SESSION['currentDomainForFLV']+ 1;
if($_SESSION['subDomainPostFix'] === 3) // since I have a subdomain sequence defined as c0,c1,c2
$_SESSION['subDomainPostFix'] = 0;
else
$_SESSION['subDomainPostFix'] = 0;
$abcdefg = $_SESSION['subDomainPostFix'];
session_write_close();
and added the added the domain in the header() call.
After this amendment flv file were serving from different domains but AGAIN my calls to server stuck at retrieving widget UIConf from the server, if a big video is running already.
Therefore, I reached to conclusion that there should be a session_write_close(); call placed after the above code.
session_start();
if(isset($_SESSION['subDomainPostFix']))
$_SESSION['subDomainPostFix'] = $_SESSION['currentDomainForFLV']+ 1;
if($_SESSION['subDomainPostFix'] === 3) // since I have a subdomain sequence defined as c0,c1,c2
$_SESSION['subDomainPostFix'] = 0;
else
$_SESSION['subDomainPostFix'] = 0;
$abcdefg = $_SESSION['subDomainPostFix'];
session_write_close();
BUT AGAIN, I didn't succeed and stuck at the same call when KDP tries to receive Widget UIConf from the server when a video is already buffering. It led me to another conclusion that I should have to place the session_write_close(); call to the point when the server is about to start the streaming of the flv file.
My suspect were two files,
MyKalturCEDirectory/kaltura/alpha/apps/kaltura/modules/keditorservices/templates/flvclipperSuccess.php
MyKalturCEDirectory/kaltura/alpha/apps/kaltura/modules/keditorservices/templates/flvproviderSuccess.php
I put session_write_close(); call in both files as follows, respectively,
//flvclipperSuccess.php
session_write_close();
$flv_wrapper->dump($chunk_size, $from_byte, $to_byte, $audio_only, $dump_from_byte);
die;
//flvproviderSuccess.php
$flv_streamer->printMetadata();
session_write_close(); //Fuad Edit
$flv_streamer->streamFlv();
die;
AND BINGOO!!! it started to work fine. I tested it with around 3 videos running simultaneously and it worked all well.
Thanks All for your kind advices.
Had a reply of the post on Stackoverflow.com where,
Mr. Marc B replied as follows,
PHP file-based sessions will lock the session file while a request is active. If you intend to use parallel requests like this, you'll have to make sure each script closes the session as soon as possible (ie: after writing out any changes) with session_write_close() to keep the lock time to a minimum.
I checked the files responsible for streaming videos in KalturaCE because streaming is where it hangs the other request and ended up with the following files.
/var/www/kalturace/kaltura/alpha/apps/kaltura/modules/keditorservices/templates/flvclipperSuccess.php
/var/www/kalturace/kaltura/alpha/apps/kaltura/modules/keditorservices/templates/flvproviderSuccess.php
so I added the line,
session_write_close();at the end of both scripts before
die; // prevent symfony from sending its headers and filling our logs with warningsBUT, it isn't working for me :(