N
N
nepster-web2013-12-06 03:47:25
PHP
nepster-web, 2013-12-06 03:47:25

SSE, what determines the return time, how serious is the load on the server?

I started digging towards SSE to return game statistics.
I actually looked at this example:

public function actionIndex()
    {
        
        print('
            <div id="help"></div>
                
                <script type="text/javascript">
                var help = document.getElementById("help");
                
                var source = new EventSource(\'/site/sse/server/\');
                source.onmessage = function(event){
                help.innerHTML += event.data;}
                
            </script>
        ');
        
    }
     
        
        

    public function actionServer()
    {
        header("Content-Type: text/event-stream");
        $t = date("H:i:s") ."<br />";
        echo "data: $t\n";
        echo "\n";
    }

At the output I got:
04:38:32
04:38:39
04:38:45
04:38:51
04:38:57
04:39:03
04:39:10
04:39:16
04:39:23
04:39:29
04:39:35
04:39:42
04:39:48
04:39:54
04:40:00
04:40:06
04:40:13
04:40:19
04:40:25
04:40:31
04:40:37
04:40:43
04:40:50
04:40:56
04:41:02
04:41:08

Recoil 6 - 7 seconds. Actually questions:
1) On what time of the answer depends? Can it be edited?
2) if, for example, I need to count the number of users who are temporarily in the table:
select count(*) from table where status=1;
How much pressure will this case create? (well, there will be approximately up to 100,000 records, on average 10,000).

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question