Results 1 to 7 of 7

Thread: Processing within publish function will impact performance?

  1. #1

    Default Processing within publish function will impact performance?

    HI,

    I have written a wowza module that overwrites the publish method for RTMP clients. I have setup wowza for ingesting three different live streams.

    Inside the publish method I have to connect to a database and get info as to which of the three streams I have to select for sending to the requesting client. I spend around 1 sec in querying the database inside this method.

    My question is while waiting inside the publish method, can the server accept connections from new clients? Thereby affecting number of concurrent clients the server can handle.

    Please let me know.

    Thanks
    Nitin

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Yes, Wowza will continue to accept other connections, but you should minimize this kind of interface. Waiting asynchronously for db query result or http response is not a good idea in a streaming application.

    Richard

  3. #3

    Default

    Thanks for the reply! Can you please clarify on why it is bad to wait inside the streaming app? As long as network timeout doesn't occur for client and since wowza continues to accept new client connections, I don't see what can go wrong. We are basing the whole design of our service around async requests from within wowza module. So worried.

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    About how much and where (onConnect, play, IMediaStreamActionNotify3) will you be doing so?

    If PPM, you might consider parsing logs quickly instead of collecting data using notifier interfaces.

    Richard

  5. #5

    Default

    We will be calling publish API from within play. inside publish we query the db and change the name of the stream as shown below:

    public void play(IClient client, RequestFunction function, AMFDataList params)
    {			
    		publish(client, function, params);
    		this.invokePrevious(client, function, params);
    }
    
    public void publish(IClient client, RequestFunction function, AMFDataList params)
    {
                   String streamName = getStreamName(client);   //call to the database is made by this function 
                   params.set(PARAM1, new AMFDataItem(streamName));
    	       this.invokePrevious(client, function, params);
    }

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    When you override publish the code you add should run when a stream is published. You would never call publish from play or anywhere in your code. The play command similarly is an override, it runs corresponding to a Flash RTMP NetStream.play(), so when you play stream, your code will call publish.

    What are you trying to accomplish?

    Richard

  7. #7

    Default

    You have some really bad code or a bad schema for your DB if it takes a second to answer! Queries of large and complex tables shouldn't take more than a few milliseconds on modern hardware. For instance I usually timeout queries in 1 second and if there is no answer (hasn't happened yet [knocking on wood]) we go to a default action.

Similar Threads

  1. impact of a hung server module
    By stanonik in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 07-26-2013, 08:39 AM
  2. Getting publish stream from play() function
    By kyanar in forum Server-side Modules and Code Samples Discussion
    Replies: 5
    Last Post: 02-13-2013, 12:29 PM
  3. Replies: 1
    Last Post: 11-23-2011, 09:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •