# Persistence options for UDP Application

**URL:** <https://community.f5.com/t/persistence-options-for-udp-application/50904>\
**Category:** Technical Forums\
**Tags:** irules, big-ip, persistence, big-ip-ltm, security\
**Created:** [September 23, 2018, 2:52pm UTC](https://community.f5.com/t/persistence-options-for-udp-application/50904 "2018-09-23T14:52:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidfisher](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@davidfisher](https://community.f5.com/u/davidfisher)\
**Post date:** [September 23, 2018, 2:52pm UTC](https://community.f5.com/t/persistence-options-for-udp-application/50904/1 "2018-09-23T14:52:16Z")

</div>

Hey Fellas,

I scoured the forums to find some info on achieving persistence for udp applications.

The VS I am using is standard, but the protocol profile is UDP with least conn - member as the load balancing algorithm.

I applied the default universal persistence profile and this irule but could not see any persistence records using

```tcl
show ltm persistence persist-records virtual

```

```tcl
when CLIENT_ACCEPTED {
    set src_IP [IP::client_addr]
    if { [session lookup uie $src_IP] equals "" } {
      session add uie $src_IP [UDP::remote_port] 1800
      log local0. "added client port [session lookup uie $src_IP] for client ip $src_IP "
    } else {
      log local0. "existing client port [session lookup uie $src_IP] for client ip $src_IP"
    }
}

```

Do I have to apply this irule to the VS or to the universal persistence profile itself?

The profile also has an option to include an irule!

---

<div class="post-metadata">

**Author:** ![davidfisher](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@davidfisher](https://community.f5.com/u/davidfisher)\
**Post date:** [September 25, 2018, 9:06am UTC](https://community.f5.com/t/persistence-options-for-udp-application/50904/2 "2018-09-25T09:06:25Z")

</div>

Came across this

```tcl
persist uie

```

command, can that be used with the current irule or do I need to change something more?

Also does the irule go to the profile or to the virtual server?

---

<div class="post-metadata">

**Author:** ![Andy\_McGrath](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/andy_mcgrath/32/28642_2.png) [@Andy\_McGrath](https://community.f5.com/u/Andy_McGrath)\
**Post date:** [September 25, 2018, 9:25am UTC](https://community.f5.com/t/persistence-options-for-udp-application/50904/3 "2018-09-25T09:25:22Z")

</div>

First why are you using

```tcl
uie

```

persistence profile if you all you need/want is source address persistence? If you are using source IP then you do not need to make is this complex with

```tcl
uie

```

and simply use source address.

Second the commands

```tcl
persist

```

and

```tcl
session

```

do different things,

```tcl
persist

```

is purely for creating, looking up and removing persistent records (core session table records). The

```tcl
session

```

is used for storing arbitrary/additional information in the session table.

Use

```tcl
persist

```

instead of

```tcl
session

```

for what you are trying to achieve, for example:

```tcl
when CLIENT_ACCEPTED {
    set src_IP [IP::client_addr]
    if {[persist lookup uie $src_IP]} {
        persist uie $src_IP
        log local0. "existing client port [persist lookup uie $src_IP] for client ip $src_IP"
    } else {
        persist add uie $src_IP 1800
        log local0. "added client port [persist lookup uie $src_IP] for client ip $src_IP "
    }
}

```

NOTE: this is just a UIE version of source address persistence and at that more complex than needed as the following does the same:

```tcl
when CLIENT_ACCEPTED {
    persist uie [IP::client_addr] 1800
}

```
