# Communication via webdev slow

**URL:** <https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 11, 2025, 4:10am UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486 "2025-03-11T04:10:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 11, 2025, 4:10am UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/1 "2025-03-11T04:10:47Z")

</div>

Hi  
I am using webdev to send progress messages from a python program (running on same machine as Ignition gateway). In total there are 7-10 such messages.  
Without these messages the python program takes around 5 seconds to run  
With the messages the program takes 1-2 minutes to run

My python code is:

```python
    url = 'http://localhost:8088/system/webdev/....../WriteTag'
    payload = {'path': "[default]Message/Msg1",'value': message }  
    requests.post(url=url, json=payload)

```

The messages are written to an Ignition udt (with first element named Msg1), a structure of 10 text tags with FIFO code to clock the messages through the udt list. These are then displayed in a perspective table.

1. Have I done something wrong? It seems a complex way to do something that 'should be' simple (but it works)
2. Is there a more efficient way to accomplish this, ie display messages from external code in a perspective display?

Thanks  
R

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 11, 2025, 1:02pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/2 "2025-03-11T13:02:15Z")

</div>

The obvious reasons it would run that much slower are:

1. your WebDev script is very inefficient
2. your WebDev script is being called far more often than you think

Can you add some logging and share some code?

---

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 11, 2025, 10:09pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/3 "2025-03-11T22:09:24Z")

</div>

tHANKS FORTHE RESPONSE kEVIN

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [March 11, 2025, 10:19pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/4 "2025-03-11T22:19:25Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/4856f3059c9a96d56ae51866398c51a9e009a999.jpeg)

---

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 11, 2025, 10:29pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/5 "2025-03-11T22:29:30Z")

</div>

oops...  
Thanks Kevin  
I don't understand your responses:

1. WebDev script inefficient.  
a. why/how is the WebDev script inefficient?  
b. The latency appears to be on the Python side ?? Does Python wait for acknowledgement from Ignition? If so can I modify the strategy?
2. WebDev script being called far more than I think  
a. How is the WebDev script being called 'far more than I think'. How can I measure this?  
b. I have a 'print' statement right before the requests.post(url=url, json=payload) line in the python script. The print statement writes to the console exactly once per message, so I assume the 'requests.post' is also called exactly once per message.

The ignition log looks like:

```python
HttpChannel	12Mar2025 09:05:26	/system/webdev/F3_Scheduler/WriteTag
msg	12Mar2025 09:05:21	[default]Message/Msg1 9:05:21 . . . . Starting

```

The 'HttpChannel' message is 2000+ lines that look like:

```python
at org.json.JSONObject.populateMap(JSONObject.java:847)

at org.json.JSONObject.(JSONObject.java:260)

```

The timestamps on the log entries indicate the same latency as when I print to console from Python with log-messaging enabled in Python. With logging disabled in Python the messages appear 20x faster on console.

The only thing I can conclude (with my limited experience) is that the 'post' from Python hangs until a response from Ignition is received.  
Is this correct?  
Can I prevent it?  
Is there an alternative method?

Thanks for your patience.  
R

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 11, 2025, 10:38pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/6 "2025-03-11T22:38:27Z")

</div>

> [@jrd](#):
>
> The only thing I can conclude (with my limited experience) is that the 'post' from Python hangs until a response from Ignition is received.

Yes, probably. AFAIK the requests library is synchronous. Most HTTP libraries probably are.

If you truly don't care about the response you might be able to modify your code to make the post in another thread, or find another HTTP library to use that will let you make requests asynchronously.

---

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 11, 2025, 10:42pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/7 "2025-03-11T22:42:28Z")

</div>

Thank you for the clarification

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 11, 2025, 11:06pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/8 "2025-03-11T23:06:29Z")

</div>

> [@jrd](#):
>
> The 'HttpChannel' message is 2000+ lines that look like:

_2000_ lines? Actually, or are you exaggerating? That suggests an enormously _deep_ object, which is not going to JSON serialize well, and you might (for instance) paying a lot of reflection overhead or something else "invisible".

---

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 12, 2025, 12:49am UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/9 "2025-03-12T00:49:24Z")

</div>

yes. 2047 in the example I selected.  
what do you mean by 'deep' object?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 13, 2025, 2:32pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/10 "2025-03-13T14:32:11Z")

</div>

That section of the stacktrace being repeated a lot means you've got a map that contains a map that contains a map, over and over and over again. That's a very inefficient data structure _in general_, but especially to represent in JSON, and also just bad for the old, crusty `org.json.JSONObject` class that backs the `system.util.json*` functions.

It doesn't necessarily explain why it takes _minutes_, but it's definitely not helping performance.

---

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [March 13, 2025, 11:45pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/11 "2025-03-13T23:45:07Z")

</div>

Thanks Paul  
What do you mean by maps?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 13, 2025, 11:49pm UTC](https://forum.inductiveautomation.com/t/communication-via-webdev-slow/103486/12 "2025-03-13T23:49:10Z")

</div>

a Map data structure, in Python a dictionary.

His point is that whatever you're doing in the handler is doing some _deep_ recursion for some reason.
