[Help!] Interval can update the data but figure not updated? Is there any refresh frequency limit in dash?

Hi all,

first many thanks to Dash helping me out of interactive plotting within web app.

Recently i’m making a app which needs to update the data frequently.

The app right now can get data from mysql and update the data and figure as well. The problem is I set the interval to 10 seconds, while every 10 seconds i can also see that the data is achieved and calculated in server but the figure can only be updated after around every 1min to 50 seconds randomly.

Besides,
the mysql server is local and query time is fast around 2,3ms.
the caculation time is around 100 ms.

Here is the most code of my app.

“”" app plotly dash"""

import dash
from dash.dependencies import Input, Output, State, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
import time
import sys
import datetime as dt
import matplotlib
matplotlib.use("Agg")
import matplotlib.pylab as plt
import base64
from login import server as server
import json


def global_store(data, strings):
    global_data = [v for i,v in enumerate(data)]
    print('Computing value....')
    return [global_data, strings]


app = dash.Dash(name='app', server=server, csrf_protect=False, url_base_pathname='/app')


app.layout = html.Div([
    html.Div([
          
            dcc.Interval(
                id='interval-component',
                interval=5*60*60*1000, # in milliseconds
                n_intervals=0
            ),
          
          html.Button(id='run', n_clicks=0, children='Run'),

          html.Div(id='signal', style={'display': 'none'}),
          html.Div(id='div-error'),
          ], style={'display': 'inline-block', 'textAlign': 'center', 'marginLeft':'27%', 'marginTop':0}),

    html.Div([
        dcc.Slider(id='index-slider3', min=0, max=loops, value=0, step=1,),
    ], style={'width': '35%'}),

    # Graphs

    html.Div([
        html.H5("Waveform 1", style={'display': 'inline-block', 'marginLeft': 300}),
        dcc.Graph(id='fig1', style={'width':850, 'height': 450, 'marginTop':0, 'marginBottom':0}),],
        style={'width': '60%', 'display': 'inline-block','marginTop': 0}),

    html.Div([
        html.H5("Waveform 2", style={'display': 'inline-block', 'marginLeft': 300}),
        dcc.Graph(id='fig2', style={'width':850, 'height': 450, 'marginTop':0, 'marginBottom':0})],
        style={'width': '60%', 'display': 'inline-block','marginTop': 0}),

    html.Div([
        html.H5("Waveform 3", style={'display': 'inline-block', 'marginLeft': 300}),
        dcc.Graph(id='fig3', style={'width':850, 'height': 450, 'marginTop':0, 'marginBottom':0})],
        style={'width': '60%', 'display': 'inline-block','marginTop': 0}),

    html.Div([
        html.H5("Waveform 4", style={'display': 'inline-block', 'marginLeft': 300}),
        html.Img(id='fig4', style={'width':850, 'height': 450, 'marginTop':0, 'marginBottom':0})],
        style={'width': '60%', 'display': 'inline-block','marginTop': 0}),
])


@app.callback(Output('interval-component', 'interval'),
              [Input('run', 'n_clicks')])
def disable_interval(n_clicks):
    if n_clicks%2 == 0:
        return 10*60*60*1000
    else:
        return 10 * 1000


@app.callback(Output('signal', 'children'),
    [Input('interval-component', 'n_intervals')],)
def compute_value(n_intervals):
    datas =  np.random.randint(1000, size=5000)
   datass =  np.random.randint(2, size=(5000,5000))
    plt.figure(figsize=(8, 6))
    plt.pcolormesh(datas [0:10], datass [10:100], datas [10:100,0:10])
    plt.colorbar()
    plt.title('Waveform at time: {}.'.format(dt.datetime.now().strftime('%c')))
    plt.savefig('spectrum.png')
    image_filename = 'wave4.png'  # replace with your own image
    encoded_image = base64.b64encode(open(image_filename, 'rb').read())
    base64_string = encoded_image.decode('utf-8')
    global_data = global_store(datas, base64_string)
    return json.dumps(global_data)


@app.callback(Output('div-error', 'children'), [Input('signal', 'children')], [], [Event('interval-component', 'interval')])
def update_error(data):
    if 'data' in data:
        return data


@app.callback(Output('fig1', 'figure'), [Input('signal', 'children')], [], [Event('interval-component', 'interval')])
def update_figure1(data):
    data = json.loads(data)
    traces = []
    traces.append(go.Scatter(
        x=list(range(len(data[0]))),
        y=data[0],
        mode='lines',#+markers',
        opacity=0.7,
    ))
    return {
        'data': traces,
        'layout': go.Layout(
            title='Waveform1',
            xaxis={'title': 'Index'},
            legend={'x': 0, 'y': 1},
            hovermode='closest'
        )
    }


@app.callback(Output('fig2', 'figure'), [Input('signal', 'children')], [], [Event('interval-component', 'interval')])
def update_figure2(data):
    data = json.loads(data)
    traces = []
    traces.append(go.Scatter(
        x=list(range(len(data[0]))),
        y=data[0],
        mode='lines',
        opacity=0.7,
    ))
    return {
        'data': traces,
        'layout': go.Layout(
            title='Waveform2',
            legend={'x': 0, 'y': 1},
            hovermode='closest'
        )
    }


@app.callback(Output('fig3', 'figure'), [Input('signal', 'children')], [], [Event('interval-component', 'interval')])
def update_figure5(data):
    data = json.loads(data)
    traces = []
    traces.append(go.Scatter(
        x=list(range(len(data[0]))),
        y= np.array(data[0]) * np.array(data[0]),
        mode='line',
        name="Power",
    ))
    return {
        'data': traces,
        'layout': go.Layout(
            title='Waveform3',
            legend={'x': 0, 'y': 1},
            hovermode='closest'
        )
    }


@app.callback(Output('fig4', 'src'), [Input('signal', 'children')], [], [Event('interval-component', 'interval')])
def update_figure6(data):
    data = json.loads(data)
    image = data[1]
    return 'data:image/png;base64,{}'.format(image.encode('utf-8').decode())



if __name__ == '__main__':
    app.run_server(host='0.0.0.0', port=9000, debug=True)
    # app.run_server()

Here is the output from server side:

Computing value....
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
Theta is : -0.30832596184310135
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:08] "POST /app2_dash-update-component HTTP/1.0" 200 -
4096.0
Computing value....
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
Theta is : -0.17874378214618614
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:18] "POST /app2_dash-update-component HTTP/1.0" 200 -
4096.0
Computing value....
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
Theta is : -0.17874378214618614
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:28] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:29] "POST /app2_dash-update-component HTTP/1.0" 200 -
127.0.0.1 - - [20/Mar/2018 16:50:29] "POST /app2_dash-update-component HTTP/1.0" 200 -

Could you help me out to this issue? Thank you so much.
Furthermore, i would like to set the interval to 0.5 seconds, is there any better way to do such frequently updating?

When i use other items like radioitem or button to update the data, it works fine, but still with large latency.

@chriddyp any ideas about this? Thank you so much!

Ah, here is one warning in the console:

/home/jfs/anaconda3/envs/tf35/lib/python3.5/site-packages/matplotlib/pyplot.py:537: RuntimeWarning:

More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning).

I personally think this means every 10 seconds data and image are calculated, but still the figures are not updated every 10 seconds.

Hm, hard to say, there is a lot going on here.

  • Are you able to simplify the examlpe, or even recreate a smaller example from scratch that demonstrates the issue?
  • Perhaps removing matplotlib to see if that fixes the issue, and then reducing the number of intervals? - Could you add print statements to the update_figure methods to verify that those functions are being called but the result isn’t being passed to the Dash frontend?
  • In short, do we know if the issue is the dash front-end (the graphs just aren’t updating) or that the callbacks aren’t getting called in the first place? If it’s a front-end issue, are there any errors in the browser console?

Hi Chris,

thanks for you reply.

I’ve added these print statements into update_figure(). It’s clear that all the functions are called but the results are not passed to the Dash.

And in the chrome dev-ops, i can see only one http-500 error for the first loading, while there is no data, i.e. the json receives None. DomContentloaded: around 1.48s, Load: 3.4s.

The console log is:
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig4
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.21304720666711463
Power: 594.1157432094764
Reactive power: -128.5251567549731
updating power
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:15:57] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:15:58] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:15:58] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig4
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.21304720666711463
Power: 594.1157432094764
Reactive power: -128.5251567549731
updating power
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:16:07] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig4
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.21304720666711463
Power: 594.1157432094764
Reactive power: -128.5251567549731
updating power
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:16:17] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig4
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.21304720666711463
Power: 594.1157432094764
Reactive power: -128.5251567549731
updating power
127.0.0.1 - - [21/Mar/2018 15:16:27] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:16:28] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:16:28] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:16:28] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig4
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.21304720666711463
Power: 594.1157432094764
Reactive power: -128.5251567549731
updating power
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:16:37] “POST /app2_dash-update-component HTTP/1.0” 200 -

When I disabled matplotlib, it still do not update every 10 seconds again around 50s.

The console log is:

Computing value…
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.3724842573309246
Power: 443.32916914843827
Reactive power: -173.21930533891583
updating power
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:28:05] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.3724842573309246
Power: 443.32916914843827
Reactive power: -173.21930533891583
updating power
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:28:15] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:28:16] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.3724842573309246
Power: 443.32916914843827
Reactive power: -173.21930533891583
updating power
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:28:25] “POST /app2_dash-update-component HTTP/1.0” 200 -
4096.0
Computing value…
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating time
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating len
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating power1
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig2
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
Theta is : -0.3724842573309246
Power: 443.32916914843827
Reactive power: -173.21930533891583
updating power
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig1
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating phase
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -
updating fig3
127.0.0.1 - - [21/Mar/2018 15:28:35] “POST /app2_dash-update-component HTTP/1.0” 200 -

I need to show at least 4 plots. I will try to simplify it later.

I’ve tried to just update the Div with now. times after calculation. It’s also failed to update the Div every 10s, instead still around 1min.

Right now i just tried to update one figure, sometimes it works, sometimes it failed. Really don’t understand what happened there.

Really amazing… Sometimes updating of 4 figures it works but really few chance to see it and just run for around a few minutes and then update again around 1 min.

Hi Chris,

it seems like i found the problem. It’s caused by the database latency.

I’m using pymysql to get the last measurements from the database with sql “SELECT * FROM table where time >= {} ORDER BY time DESC LIMIT 1”, where the time is the right now time - 3 seconds. The server log shows even though the right now time is updating every 10 seconds, the last measurement’s time does not change for 1 min. It means the Dash receiving the same data for around 1 mins, that’s why the Dash showing updating but figure not updated.

Thanks again for your help!

1 Like