# Performance issue with several scattergl subplots

**URL:** <https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944>\
**Category:** plotly.js\
**Created:** [August 29, 2019, 8:26am UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944 "2019-08-29T08:26:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerome](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jerome](https://community.plotly.com/u/jerome)\
**Post date:** [August 29, 2019, 8:26am UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/1 "2019-08-29T08:26:23Z")

</div>

I need to display about 20 line charts with data being streamed from a socket and updated every 50ms.  
Each trace has 10.000 data points.  
The lines restart from the left when reaching the end of the window, so the whole trace needs to be updated (and not just extended).

I’ve tried using different plots but quickly ran into the webgl context limit.  
I switched to drawing subplots on the same plot, but after about 3 subplots, performance becomes an issue: refresh rate drops, updates hang, then complete at once.

Is there any technique to make these trace updates more fluid ?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 29, 2019, 6:28pm UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/2 "2019-08-29T18:28:12Z")

</div>

See [https://github.com/plotly/plotly.js/issues/2333#issuecomment-363143357](https://github.com/plotly/plotly.js/issues/2333#issuecomment-363143357)

---

<div class="post-metadata">

**Author:** ![jerome](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jerome](https://community.plotly.com/u/jerome)\
**Post date:** [August 29, 2019, 10:44pm UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/3 "2019-08-29T22:44:07Z")

</div>

Thanks @etienne . I did see that issue. However, I am using only 1 Plot with 20 subplots (for that exact reason, ie: webgl context limit)

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 30, 2019, 2:08pm UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/4 "2019-08-30T14:08:35Z")

</div>

Ok - could you share a reproducible example to help us help you?

---

<div class="post-metadata">

**Author:** ![jerome](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jerome](https://community.plotly.com/u/jerome)\
**Post date:** [September 3, 2019, 4:30am UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/5 "2019-09-03T04:30:59Z")

</div>

Here is a quick and dirty example with 10 lines, each containing 30.000 data points.  
About half way through, chrome starts to take over 100% cpu and the restyle method takes exponentially longer.  
One thing I notice is that some svg elements are continuously updated while not being used.

[https://codepen.io/jerokh/pen/vYBepXV](https://codepen.io/jerokh/pen/vYBepXV)

---

<div class="post-metadata">

**Author:** ![jerome](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jerome](https://community.plotly.com/u/jerome)\
**Post date:** [September 4, 2019, 1:51pm UTC](https://community.plotly.com/t/performance-issue-with-several-scattergl-subplots/27944/6 "2019-09-04T13:51:28Z")

</div>

@etienne do you think there is any hope of achieiving this with plotly or am I doomed to write raw webgl ?
