Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
redis, temp dir, swoole
  • hi.
    how can i use redis for log?(fuel error log and user activity log) and access it.
    (i use redis for cache and session and it work very fast in massive requests)
    how can i delete temp dir files and when (/fuel/app/tmp) ? do i need  define cron job and run task (fuel/app/tasks/)?
    i save many files in top of public dir (/home/site/files). is this effect on application performance?(i use apache)
    is define all route in config/route.php effect performance?(good | bad | nothing)
    and finnaly how can i use swoole extenstion in fuel request?
  • HarroHarro
    Accepted Answer
    Fuel uses monolog for all logging.

    In order to use a different monolog handler, you need to extend the Log class in your app, and overload the static function initialize(), where you can configure the static::$monolog instance any which way you want.

    We keep log files under control using a bash cron job that simply deletes log files other than x days. Something like this:

    find /var/www/html/app/logs -type f -mtime +90 -delete
    find /var/www/html/app/logs -type d -empty -delete

    which deletes all files older than 90 days, and then removes empty directories.

    Yes, directories with a large number of files will impact performance slightly. How much, depends on the file system used, how good that caches, the amount of cache memory available, how many files there are, and obviously how fast your storage system is.

    Hardcoding all routes will have a slightly positive effect on performance, as it doesn't have traverse the file system and search for a matching controller. Again, how much depends on the same factors as above.

    No experience with Swoole, sorry.
  • Thanks as always
    Right now I'm working on your solution for monolog.
    Your solution was very simple and very good to delete files (I thought I had to do with php !!!! how stupid I am)
    Talking about over a hundred thousand files (images, corporate files, workflow files, etc.) Moving files to a separate server may not be a bad idea if security is not compromised (maybe I should write a file manager). Of course they might not use the files too much and just for archiving
    I defined all the paths of a module. The response rate was faster than before.
    Another thing I tested was the use of the "Use" command for different files instead of the standard fuelphp itself, and again the response rate increased after several requests, such as "use \Fuel\Core\Uri" and Uri instead of \Uri I don't know if this is the solution or is it temporary or am I wrong?
    On the swoole, if you look at its capabilities and speed, you'll be very interested in it.
    Another case is still enlarged after resizing and resizing the image but unfortunately I couldn't find a solution.

  • HarroHarro
    Accepted Answer
    For File handling you might want to look at Frank's FlySystem ( which is great in abstracting File I/O to different storage backends, we use it for both archiving and for publishing public files to a separate webserver which is optimized to serve static files.

    If you "use" a core class directly, you disable Fuel's class extension mechanism, both in your app and in any package you may use that does that. Other than that, it doesn't do any harm.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion