ID Counters on larger apps

Just wanted to know how those with larger apps and things being created or copied simultaniously handle implementing a id counter

Currently there are a few ways I can think of but I feel they all fail under load.

a) have a counter (let’s call it invoice_id_counter) on a thing (in my case the organisation) and each time I create a new thing, increase the counter

b) same as above but I use a database trigger to update the item

No one?