peterberbec / yourls-keyword_charset_length

Allows simple charset hook override
10 stars 7 forks source link

DB Access #2

Closed peterberbec closed 8 years ago

peterberbec commented 8 years ago

per http://berb.ec/m8nbq

cgmckeever commented 13 days ago @peterberbec Awesome! code looks good ... we arent actively using it much now - we were having volume issues and killing the DB when we'd try to make them too quickly :(

Is there some part of my code that is particularly DB intensive?

As I read it, all the plugin does is pass a pre-set length, the option '0' to enforce limited charset, and the limited charset into yourls_rnd_string(), forcing it into the 1st option of this case statement: http://berb.ec/67ade

From what I see, the case statement resolves to an assignment statement, no matter what option is given. The one we go through has a ?: test, but that is at worst one additional in-memory comparison. The extra database access could be occurring because $link_length and $charset_liste need to be read every link creation. This may cause two extra reads DB per link creation.

Is it possible, necessary and/or a good idea to force $link_length and $charset_liste to remain in RAM? This would remove two potential DB hits per link.

Comments, suggestions?

cgmckeever commented 8 years ago

OH .. sorry for the confusion, I meant we stopped using YURLS itself cause we were hitting the piss nuts out of it! sorry about that .. your stuff looks tight!

peterberbec commented 8 years ago

OHH! Sorry. I thought I had coded something and blown up your server! Phew!!!!

Closing.

Resolution: @peterberbec is paranoid.