fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
218 stars 135 forks source link

Using tx.Submit in thread #101

Open tahseenjamal opened 2 years ago

tahseenjamal commented 2 years ago

Can I use tx.Submit in thread ? I can see in the example_test it is used inside http Handler function

Also if I use tx.Submit in 10 threads, the delivery receipts traffic would increase. Will the Handler function of Transceiver perform fast enough ?

alexanderomnix commented 2 years ago

I think as stated in the example it uses goroutines, so no problems with that and no performance benefit over calling over threads, the session is managed by the library unless you create multiple connections, some problems you gonna get is a timeout and the disconnections over a large number of submitSM, you should use rate limit and config the window param accordingly.

RateLimiter: rate.NewLimiter(rate.Limit(maxFreqLimiter), 1), // x per second is a good way to control it.

tahseenjamal commented 2 years ago

@alexanderomnix thanks for replying. I observed that tx.Submit takes 250ms to complete. Which means on a single connect max TPS of 4. And that is the reason, I asked if I can use go routines. Correct me if am wrong here

Yes, I do use rate limit and window parameter