Pastebin – light at the end of the tunnel

A number of people have emailed or left comments frustrated by the speed of pastebin. Over the past few months I’ve spent the odd ten minutes here and there tweaking it in the face of ever-increasing load. It’s clear the software just isn’t up to the task anymore, which was particularly evidenced by a recent slashdotting.

Over the next few days I’m rewriting the internals to be much faster, and hopefully release it over the weekend.

Wish me luck!

30 thoughts on “Pastebin – light at the end of the tunnel

  1. David Precious

    Good luck Paul – the pastebin is a rather useful tool, but its slowness at times is a major drawback – it’ll be nice if you can achieve a good speedup πŸ™‚

  2. femu

    Hi Paul,

    good luck from me too! I have one small question left. I installed the pastbin on my website and it works like charme. Now I also wanted to install it local on my xampp, but get an error, which I canΓƒβ€žt figure out, what’s wrong. My xampp installation is a one-to-one copy of my webspace. Here the error:

    Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user ‘pastebin’@’localhost’ (using password: YES) in C:\Programme\xampp\htdocs\pastebin\db.mysql.class.php on line 46
    Unable to connect to database

    So I’m wondering, where the user pastbin is coming from, although I have the correct DB user in the config file. Or what else needed to be configured different in a local installtion.

    Thanks,
    femu

  3. lordelph Post author

    femu: sounds like you simply need to create a suitable user with access to the pastebin database. Those settings come from your configration file.

    Good news on the pastebin updates, I’ve written a drop-in replace for the mysql storage class which simply uses the filesystem. It’s not quite ready for prime time, but should be ready for release this week.

  4. lordelph Post author

    Further update – revised storage class now completely working. I’m going to do some benchmark comparisons and hopefully make it live over the weekend…

  5. Nick Stanko

    Great service Paul! I was wondering if the speed could also be improved by allowing privately hosted clusters. For example an organization could download an encoded (or open source πŸ™‚ copy of a stable release, could be setup to report stats/content to Pastebin. We would love to have pastebin.officediggs.com

    Let me know if you would be interested in testing this with us. Thanks for the valuable tool!

  6. lordelph Post author

    pastebin is GPL licenced, though the current tarball is a few point releases old – will update that when I release the improved version.

    The new release is ready to go, I just need to write something to port all the existing posts over to it.

  7. Stephen

    Hope all goes well for ya’.

    It’s taking me about 30 seconds to get a server response from the pastebin. I’m assuming MySQL is the source?

    I’ve really liked the idea of the pastebin and started coding…
    You can see my work at The Code-Bin.

  8. Daniel Aleksandersen

    Maybe a little “donate to help get us better hardware and to keep the service free” PayPal button?

    I looked trough Pastbin but could not find any… (why is it that every time I have tried trowing money at someone today they just do not seam to want it!?)

  9. cw

    for the love of all the pastebin users everywhere, can’t you just turn it off until you work it out? maybe just provide a list of pastebin sites that actually work right?

    also, maybe hang out in ##php, #sql, and #mysql to try and figure out the problem. with some simple indexing, this thing should run just fine with even several millions of rows in the table. And my old dual celeron 466 (asus bp6, lovely mainboard) server survived a slashdoting (topping out at 24MBps sustained traffic) so don’t use that as a cop-out, it’s all about realistic optimization.

  10. Tracy

    I have one that seems pretty quick at http://www.pasteserver.net.

    I think Paul provides a nice service myself and you don’t have to use his pastebin. Its not like he does it for a living, I think it is more of a hobby and he happens to offer it for *Free* if anyone wants to use it.

  11. lordelph Post author

    Well done on the slashdotting. You know pastebin is open source, you’re welcome to apply your superior skills to it!

    The new version with, ahem, realistic optimization, is coming soon though. Hang on in there or use an alternative!

  12. DanBUK

    Just wonder if you got my emails? Concerning the DB Schema. Some comments about the conceived issue I have placed in my blog, but if you drop me an email to the one on this post I can send you over all the changes I have made to the DB Schema. I have made some minor changes to the PHP code to support titles to the posts, but that was just beautification.

    Cheers,
    Daniel

  13. lordelph Post author

    Thanks Dan, I did get the email. There is an index like the you one you suggested, but the idea of switching to InnoDB isn’t a bad idea – I might trial that for a few days as it will be the weekend before I have time to complete the other changes I’ve made.

  14. DanBUK

    Hi Paul,
    I have packaged up an updated copy of the app to include some changes I have added. You can find the changes in this recent blog post, here.
    I have also setup a copy of the site running on http://1t2.us/ you should be able to download the current code from that.
    How is your progress going on with the application? (Hope that I haven’t duplicated work that you have done!)

    Cheers,
    Dan.

  15. DanBUK

    I have added password protection to 1t2.us and the improved code is available to download.

    I really think the improvements I have made to the logic inside the getPost method and some separation of domains to a reference table will mean that performance against MySQL will have improved alot. I have updated UPGRADE/INSTALL to reflect these changes.

  16. Patrick

    You might want to change the source download link on pastebin.com I started modifying the code only to realize you had a new version out. πŸ™‚

  17. KB

    LE – would you like to send me a copy of your current code? I’ll see what I can do to help you with MySQL optimizations. One thing many have done to speed high volumes of queries up is to use MySQL replication so that readers read only from the replication slaves and writers write to the replication master. One other thing this allows you to do – replication slaves can use a different storage engine than the master, so typically, a master might use InnoDB where slaves might use Memory or MyISAM.

  18. KB

    Of course, I didn’t mention that using your slow query log can help you determine what queries are taking a long time and can help you determine where to invest optimization efforts (from the MySQL side).

    EXPLAIN SELECT is your friend when doing query optimizations.

    Good indexing is key to getting queries to run quickly. After that, utilizing prepared queries allow the query cache to help you.

    Any time you can get the server to handle processing, that’s likely to speed things up too because more data transferred means more network use and that can actually be slower than disk access. Removing SELECT * is a classic optimization (don’t know if you use it or not) and instead replace it with SELECT followed by just the columns you need. I could go on, but I think you get the idea. If you want help, please let me know.

  19. Lance E Sloan

    Good luck getting this working again. By the time I learned about pastebin, it was broken and throwing up DB errors all over. If it works as well as your description of it, I will share it with other developers once it’s working.

  20. Dave C

    @Sloan: There is also http://www.pastecode.com which is still working.

    @LordElph: My only frustration is the amount of spamming going on with these pastebin installations. Have you considered adding some anti-spamming measures to the new release? I’ve stopped using pastebin for the most part aside from using it for IRC channels to paste snippets. Pastebin has turned into less of a pastebin and more of a wastebin. It’s a shame too. Pastebin was, is, and always will be a great tool for developers like myself.

  21. yuro

    “Over the next few days IÒ€ℒm rewriting the internals to be much faster, and hopefully release it over the weekend.”

    So where is update? πŸ™‚

  22. SunRayCafe

    Hey, just finished reading through the comments, was wondering if the latest greatest has been packaged and is available. Is DanB’s package an official Pastebin package, or an alternative?

  23. Tom Strickland

    As a newbie, I can’t get pastebin to work. I don’t understand some of the instructions such as:

    submit a code fragment to pastebin, getting a url like http://pastebin.com/1234

    So where do I get the url?

    When I put some code into pastebin I get an error message like this:

    Query failure: Can’t open file: ‘pastebin.MYI’. (errno: 145)
    insert into pastebin (poster, domain, posted, format, code, parent_pid, expires,expiry_flag) values (‘Tom Strickland’, ”, now(), ‘text’, ‘tom@HP\:~$ kdesu kate /etc/firefox/firefoxrc\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nX Error\: BadDevice, invalid or uninitialized input device 167\r\n Major opcode\: 144\r\n Minor opcode\: 3\r\n Resource id\: 0x0\r\nFailed to open device\r\nkbuildsycoca running\.\.\.\r\n\^A\r\ntom@HP\:~$\r\ntom@HP\:~$’, ‘0’, DATE_ADD(NOW(), INTERVAL 1 MONTH), ‘m’)

    At this poiint “Help” doesn’t help.

    I obviously don’t find pastebin as easy to use as you say it is. What to do?

    Thanks!

  24. lordelph Post author

    Damn, sorry folks. Seems I’ve let things lapse a lot longer than intended. Pastebin always was just a little side project and I’ve been very busy with “real” work of late.

    I’ve repaired the error reported above, and will see if I can roll out the new version this week. Once and for all!

  25. Pingback: LordElph’s Ramblings » Pastebin Reloaded!

Comments are closed.