• Hello to All!

    I have a Python script that generates an array of posts to publish on a WordPress site. Posts are stored in memory in a form of array in JSON format for uploading to the WordPress via the REST API using Python requests.post function.

    First 300-400 posts work great and a posting speed is about several posts per second. Htop shows several mariadb instances working, memory is not overloaded and uses 1-2Gb from 12Gb total.

    But after that everything starts to slow down dramatically. After a while only 2 mariadb processes remain consuming about 90-100% of one CPU core jumping from one core to another. Other cores are almost free.

    The speed of posting drops to 1-2 posts per 10-15 seconds and gradualy almost dies in time. But I need to record several thousands of posts so it is not acceptable. I did not tweak database settings much, so what I have im /etc/mysql/my.conf:

    [mariadb]
    performance_schema=ON
    skip-name-resolve=1
    innodb_buffer_pool_size=2G
    innodb_log_file_size=512M
    slow_query_log=1
    tmp_table_size=64M
    max_heap_table_size=64M
    thread_handling=pool-of-threads
    query_cache_size=0

    I have tried Redis, WP-Cache, WP-Optimize but it’s all for reading, they don’t work for writing.

    Maybe someone could direct me where though to dig?

    Thank you in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • What if you execute wp-cli to create the commands.

    I had to do a WP user migration and tried several things. I ended up creating a script that directly loads wp-load.php and runs some WordPress functions. That was super fast!

    Thread Starter nkir2023

    (@nkir2023)

    Hello!

    We have found the root cause of the problem. It is not MariaDB but WordPress API loading new post. The issue is that we need to publish large amount of posts with the same title. There are some checks in API that use SELECT for the whole wp_posts table and while the number of posts encreases it runs more and more slowly.
    So is there any way to avoid checks? I can see that if I publish posts as Drafts it works much quicker.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Posting Slowdown’ is closed to new replies.